Class “Blob”

Object > Blob

Represents raw data of a given type.

Type: Blob extends Object
Constructor: public
Singleton: No
Namespace: global
Direct subclasses: File
JSX Support: No

Constructor

new Blob(blobParts?, options?)

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

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

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: (empty string)
Settable: No

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