← Back to release summary

FileAPI: Blob.bytes()

Category
File APIs
Type
Chromium catches up
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

The bytes() method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.

Motivation

Before this change developers could not access an ArrayBuffer directly and had to create a Uint8Array view, and some APIs returned different types which leading to inconsistency. To improve this, design principles have changed[1] in w3c tag side, so the spec was updated[2] accordingly. The new spec removes those hassles, and because WebKit, Firefox and Node.js already support it, bringing it to Chromium will improve interoperability as well. [1] https://github.com/w3ctag/design-principles/issues/463 [2] https://github.com/w3ctag/design-principles/pull/480 [3] https://github.com/w3c/FileAPI/pull/198

Standards & signals

Docs: https://w3c.github.io/FileAPI/#dom-blob-bytes

View on chromestatus.com