Skip to main content

Binary Utilities provides a set of functions to simplify working with binary data. There are a couple of different ways to deal with binary data in the JavaScript APIs for browser and Node.js, and some small but annoying "gotchas" that can trip up programmers when working with binary data.


import {toArrayBuffer} from '';


toArrayBuffer(binaryData : *) : ArrayBuffer

"Repackages" a binary data in non-array-buffer form as an ArrayBuffer.

  • binaryData - ArrayBuffer, Buffer (Node.js), typed array, blob, ...


  • Most functions in that accept binary data call toArrayBuffer(...) on input parameters before starting processing, thus ensuring that functions work on all types of input data.