v143 · file apis
FileAPI: Blob.bytes()
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.
concepts
-
Blob.bytes()
Live: call
blob.bytes()side-by-side with the arrayBuffer round-trip on text, files, or a 5 MB stress test. Compares bytes and timings. -
Streaming vs bytes
When to pick bytes() vs stream() vs arrayBuffer(). Three-way benchmark on a blob you size, with the peak-memory tradeoff called out.
-
File hash tool
Drop any file, get SHA-1 / 256 / 384 / 512 hashes in parallel, plus a head-to-head timing of
Blob.bytes()vsarrayBuffer()vsFileReader. -
Drag-drop hex viewer
A real file inspector — hex+ASCII dump of any file with magic-number signature detection (40+ signatures: PNG, ZIP, WASM, ELF, SQLite, …). One
blob.bytes()call powers the whole thing.
why it shipped
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.