A Blob
encapsulates immutable, raw data that can be safely shared across multiple worker threads.
class
buffer.Blob
class Blob
Returns a promise that fulfills with an ArrayBuffer containing a copy of the
Blob
data.The
blob.bytes()
method returns the byte of theBlob
object as aPromise<Uint8Array>
.const blob = new Blob(['hello']); blob.bytes().then((bytes) => { console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ] });
Returns a new
ReadableStream
that allows the content of theBlob
to be read.Returns a promise that fulfills with the contents of the
Blob
decoded as a UTF-8 string.