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
Blobdata.The
blob.bytes()method returns the byte of theBlobobject as aPromise<Uint8Array>.const blob = new Blob(['hello']); blob.bytes().then((bytes) => { console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ] });Consume as a Uint8Array, backed by an ArrayBuffer
Consume as JSON
Returns a new
ReadableStreamthat allows the content of theBlobto be read.Returns a promise that fulfills with the contents of the
Blobdecoded as a UTF-8 string.