-
-
Save jsmits/fe67af22f0e472ea9aed647e49eeb4dc to your computer and use it in GitHub Desktop.
ArrayBuffer <-> JSON <-> ArrayBuffer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// array buffer to JSON | |
const dataString JSON.stringify(Array.from(new Uint8Array(arrayBuffer))); | |
// send around | |
// JSON to ArrayBuffer | |
new Uint8Array(JSON.parse(dataString)).buffer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment