티스토리 뷰

공부

[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

'공부' 카테고리의 다른 글

[Sh] email.sh  (0) 2020.05.18
[Jenkins] backup.sh  (0) 2020.05.18
[Sh] check disk size (df & du)  (0) 2020.05.17
[Sh] merge files  (0) 2020.05.17
[Sh] count parameter  (0) 2020.05.17
댓글