공부

[JS] ArrayBuffer <-> JSON <-> ArrayBuffer

승가비 2020. 5. 17. 21:32
728x90
// array buffer to JSON
const dataString JSON.stringify(Array.from(new Uint8Array(arrayBuffer)));

// send around

// JSON to ArrayBuffer
new Uint8Array(JSON.parse(dataString)).buffer

https://gist.github.com/nuclearglow/ab251744db0ebddd504eea28153eb279

 

ArrayBuffer <-> JSON <-> ArrayBuffer

ArrayBuffer <-> JSON <-> ArrayBuffer. GitHub Gist: instantly share code, notes, and snippets.

gist.github.com

 

728x90