Name
BlobBuilder — create new Blobs
Synopsis
A BlobBuilder object is used to create new Blob objects out of strings of text and bytes from
ArrayBuffer objects and other Blobs. To build
a Blob, create a BlobBuilder, call append() one or more times, and then call
getBlob().
Constructor
newBlobBuilder()
Create a new BlobBuilder by calling the BlobBuilder() constructor with no
arguments.
Methods
void append(string
text, [string
endings])
append(string
text, [string
endings])Appends the specified text,
encoded using UTF-8, to the Blob that is being built.
void append(Blob
data)
append(Blob
data)Append the content of the Blob
data to the Blob that is being
built.
void append(ArrayBuffer
data)
append(ArrayBuffer
data)Append the bytes of the ArrayBuffer
data to the Blob that is being
built.
Blob getBlob([string
contentType])
getBlob([string
contentType])Return a Blob that represents all the data that has been
appended to this BlobBuilder since it was created. Each call to
this method returns a new Blob. If
contentType is specified, it will be
the value of the type property
of the returned Blob. If unspecified, the returned Blob will have
the empty string as its type.
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