Blob: arrayBuffer() method
BaselineWidely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
Note: This feature is available inWeb Workers.
ThearrayBuffer()
method of theBlob
interface returns aPromise
that resolves with the contents of the blob asbinary data contained in anArrayBuffer
.
Syntax
arrayBuffer()
Parameters
None.
Return value
A promise that resolves with anArrayBuffer
that contains the blob'sdata in binary form.
Exceptions
While this method doesn't throw exceptions, it may reject the promise. This can happen,for example, if the reader used to fetch the blob's data throws an exception. Anyexceptions thrown while getting the data will be converted into rejections.
Usage notes
While similar to theFileReader.readAsArrayBuffer()
method,arrayBuffer()
returns a promise rather than being an event-based API, as isthe case with theFileReader
interface's method.
Specifications
Specification |
---|
File API # dom-blob-arraybuffer |