Name
Blob — an opaque chunk of data, such as file contents
Synopsis
A Blob is an opaque type used to exchange data between APIs. Blobs may be very large and may represent binary data, but neither is required. Blobs are often stored in files, but this is an implementation detail. Blobs expose only their size and, optionally, a MIME type, and they define a single method for treating a region of a Blob as a Blob.
A number of APIs use Blobs: see FileReader for a way to read the content of a Blob and BlobBuilder for a way to create new Blob objects. See XMLHttpRequest for ways to download and upload Blobs. See Blobs for discussion of Blobs and the APIs that use them.
Properties
readonly unsigned longsizeThe length, in bytes, of the Blob.
readonly stringtypeThe MIME type of the Blob, if it has one, or the empty string otherwise.
Methods
Blob slice(unsigned long
start, unsigned long
length, [string
contentType])
slice(unsigned long
start, unsigned long
length, [string
contentType])Return a new Blob that represents the
length bytes of this Blob starting at
offset start. If
contentType is specified, it will be
used as the type property of
the returned Blob
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access