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
new
BlobBuilder
()
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
.
Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.