Blob
Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:146
A Blob encapsulates immutable, raw data that can be safely shared across
multiple worker threads.
v15.7.0, v14.18.0
Extended by
Section titled “Extended by”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Blob(sources, options?): Blob;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:165
Creates a new Blob object containing a concatenation of the given sources.
{ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into the ‘Blob’ and can therefore be safely modified after the ‘Blob’ is created.
String sources are also copied into the Blob.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sources | ( | ArrayBuffer | Blob | BinaryLike)[] |
options? | BlobOptions |
Returns
Section titled “Returns”Blob
Properties
Section titled “Properties”readonly size: number;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:151
The total size of the Blob in bytes.
v15.7.0, v14.18.0
readonly type: string;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:156
The content-type of the Blob.
v15.7.0, v14.18.0
Methods
Section titled “Methods”arrayBuffer()
Section titled “arrayBuffer()”arrayBuffer(): Promise<ArrayBuffer>;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:171
Returns a promise that fulfills with an ArrayBuffer containing a copy of
the Blob data.
Returns
Section titled “Returns”v15.7.0, v14.18.0
bytes()
Section titled “bytes()”bytes(): Promise<Uint8Array<ArrayBufferLike>>;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:182
The blob.bytes() method returns the byte of the Blob object as a Promise<Uint8Array>.
const blob = new Blob(['hello']);blob.bytes().then((bytes) => { console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]});Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
slice()
Section titled “slice()”slice( start?, end?, type?): Blob;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:191
Creates and returns a new Blob containing a subset of this Blob objects
data. The original Blob is not altered.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
start? | number | The starting index. |
end? | number | The ending index. |
type? | string | The content-type for the new Blob |
Returns
Section titled “Returns”Blob
v15.7.0, v14.18.0
stream()
Section titled “stream()”stream(): ReadableStream;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:202
Returns a new ReadableStream that allows the content of the Blob to be read.
Returns
Section titled “Returns”v16.7.0
text()
Section titled “text()”text(): Promise<string>;Defined in: node_modules/.pnpm/@types+node@24.8.1/node_modules/@types/node/buffer.d.ts:197
Returns a promise that fulfills with the contents of the Blob decoded as a
UTF-8 string.
Returns
Section titled “Returns”Promise<string>
v15.7.0, v14.18.0