A Blob encapsulates immutable, raw data that can be safely shared across multiple worker threads.
class
buffer.Blob
class Blob
Consume the blob as an ArrayBuffer
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 readable stream of the blob's contents
Returns a promise that fulfills with the contents of the
Blobdecoded as a UTF-8 string.