Blob.prototype.arrayBuffer

Returns a promise that resolves with an ArrayBuffer containing the entire contents of the blob as binary data.

Syntax

arrayBuffer()

Return value

A promise that resolves with an ArrayBuffer.

If the contents of blob doesn’t fit in an ArrayBuffer, the promise is rejected with a RangeError.

Example

let blob = new Blob(['Hello, world!'])
blob.arrayBuffer().then(buffer => {
  print(buffer.byteLength)
})
13