Turn any binary data container into an ArrayBuffer in sync way. Detected containers:
- data-uri string
- base64 string
- plain string
- Array of Arrays
- Number (creates new ArrayBuffer of the defined length in bytes)
It also handles some custom data types, like
AudioBuffer etc., but in general it returns
null for objects not looking like binary data containers. Note also that it does not handle Blob and File, since they require async API.
var toArrayBuffer =var context =// Get array buffer from any objectab =ab =ab =ab =ab =ab =
- to-arraybuffer − convert Buffer to ArrayBuffer, fast implementation.
- data-uri-to-buffer − advanced data-uri decoder.
- save-file — save any input data to file in node/browser.
- buffer-to-arraybuffer — convert surely known Buffer datatype to ArrayBuffer.
© Dmitry Yv 2018. MIT Licensed.