Created
January 26, 2018 10:30
-
-
Save nuclearglow/ab251744db0ebddd504eea28153eb279 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 |
vaebe
commented
Dec 9, 2022
This was extremely helpful to me! This is truly an outstanding answer! Thank you, nuclearglow - you're a lifesaver!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment