Class “Blob”

Object > Blob

Represents raw data of a given type.

Constructor public
Singleton No
Namespace global
Direct subclasses File
JSX support No

Constructor

new Blob(blobParts?, options?)

Parameter Type Optional Description
blobParts any[] Yes Array of ArrayBuffer, Blob, string, or any typed array. Any other type will be stringified. Strings are encoded as UTF-8.
options {type?: string} Yes type represents the MIME type of the blob content. Defaults to empty string.

Methods

arrayBuffer()

Reads the blob data into an ArrayBuffer and returns it in a promise. Each call creates a new in-memory copy of the data.

Returns Promise<ArrayBuffer>

text()

Decodes the blob data as a string and returns it in a promise.

Returns Promise<string>

Properties

size

Size of the blob data in bytes

Type number
Default 0
Settable No
Change events No

This property can only be set via constructor. Once set, it cannot change anymore.

type

The MIME type of the blob data

Type string
Default ''''
Settable No
Change events No

This property can only be set via constructor. Once set, it cannot change anymore.