Skip to main content

Blob

The Blob interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.

MDN Reference

Extended by​

Methods​

arrayBuffer()​

arrayBuffer(): Promise<ArrayBuffer>;

The arrayBuffer() method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.

MDN Reference

Returns​

Promise<ArrayBuffer>


bytes()​

bytes(): Promise<Uint8Array<ArrayBuffer>>;

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.

MDN Reference

Returns​

Promise<Uint8Array<ArrayBuffer>>


slice()​

slice(
start?,
end?,
contentType?
): Blob;

The slice() method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called.

MDN Reference

Parameters​

ParameterType
start?number
end?number
contentType?string

Returns​

Blob


stream()​

stream(): ReadableStream<Uint8Array<ArrayBuffer>>;

The stream() method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.

MDN Reference

Returns​

ReadableStream<Uint8Array<ArrayBuffer>>


text()​

text(): Promise<string>;

The text() method of the Blob interface returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.

MDN Reference

Returns​

Promise<string>

Properties​

size​

readonly size: number;

The size read-only property of the Blob interface returns the size of the Blob or File in bytes.

MDN Reference


type​

readonly type: string;

The type read-only property of the Blob interface returns the MIME type of the file.

MDN Reference