-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add handling for ArrayBuffer data #7
Comments
I think it can be done by passing a replace function to JSON.stringify, so it would output something like this:
|
I think the point is how to get this thing done gracefully. After adding the type of exported data, you could not simply use func_dict={
"ArrayBuffer":{
"type": ArrayBuffer,
"func": func_to_exported_arraybuffer,
}
}
function(data_to_exported) {
forEach(func_dict, function(func_item){
if (data_to_exported instanceof func_item["type"]){
return {
'type': func_item["type"],
'data': func_to_exported_arraybuffer(data_to_exported)
}
}
})
return {
'type': object,
'data': JSON.stringify(data_to_exported)
}
} |
It should be possible with JSON.parse() using a reviver function Along with the replacer function for JSON.stringify() |
I've no plans to work on this but I'd accept a pull request implementing the feature |
Sorry, i've no plan to work on this right now but thank you anyway! |
Hello, kinda digging this up, and It might be a bit out of place, but re-doing https://www.npmjs.com/package/typeson or even using it might be a good solution to handle all the exotic types presents in indexeddb |
As earlier, I'm happy to accept a pull request but won't be working on this myself. For people who need this functionality now, there's a Dexie extension, dexie-export-import, that supports a range of types. The main disadvantage is that it's not as lightweight. |
ArrayBuffer should be exported via some tricky way instead of
JSON.stringify
.The text was updated successfully, but these errors were encountered: