Web APIs

Blob.bytes()

Try the free JavaScript compiler

Read the Blob into a Uint8Array without a separate ArrayBuffer-to-view step. The whole result occupies memory. Example console output: true 9.

Formal Syntax & Structure

javascript syntaxjavascript
blob.bytes()

Return Value

Promise<Uint8Array>

Byte array of Blob contents.

Working Example

Example Snippetjavascript
(async () => {const b=new Blob([new Uint8Array([8,9])]); const bytes=await b.bytes(); console.log(bytes instanceof Uint8Array,bytes[1]);})()
JavaScript Reference