ObsoleteThis feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
The BlobBuilder
interface provides an easy way to construct Blob
objects. Just create a BlobBuilder
and append chunks of data to it by calling the append()
method. When you're done building your blob, call getBlob()
to retrieve a Blob
containing the data you sent into the blob builder.
Note: The BlobBuilder
interface has been deprecated in favor of the newly introduced Blob
constructor.
Method overview
void append(in ArrayBuffer data);
|
void append(in Blob data);
|
void append(in String data, [optional] in String endings);
|
Blob getBlob([optional] in DOMString contentType);
|
File getFile(in DOMString name, [optional] in DOMString contentType);
|
Methods
append()
Appends the contents of the specified JavaScript object to the Blob
being built. If the value you specify isn't a Blob
, ArrayBuffer
, or String
, the value is coerced to a string before being appended to the blob.
void append( in ArrayBuffer data ); void append( in Blob data ); void append( in String data, [optional] in String endings );
Parameters
data
- The data to append to the
Blob
being constructed. endings
- Specifies how strings containing
\n
are to be written out. This can be"transparent"
(endings unchanged) or"native"
(endings changed to match host OS filesystem convention). The default value is"transparent"
.
getBlob()
Returns the Blob
object that has been constructed using the data passed through calls to append()
.
Blob getBlob( in DOMString contentType Optional );
Parameters
contentType
Optional- The MIME type of the data to be returned in the
Blob
. This will be the value of theBlob
object's type property.
Return value
A Blob
object containing all of the data passed to any calls to append()
made since the BlobBuilder
was created. This also resets the BlobBuilder
so that the next call to append()
is starting a new, empty blob.
getFile() '
Returns a File
object.
File getFile( in DOMString name, [optional] in DOMString contentType );
Parameters
name
- The file name.
contentType
Optional- The MIME type of the data to be returned in the
File
. This will be the value of theFile
object's type property.
Return value
A File
object.
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome No support 8 — 24 No support 8 — 24 Prefixed' Implemented with the vendor prefix: WebKit |
Edge No support 12 — 79 No support 12 — 79 Prefixed' Implemented with the vendor prefix: MS |
Firefox No support 6 — 18 No support 6 — 18 Prefixed' Implemented with the vendor prefix: Moz
Notes' Starting in Firefox 14, using |
IE Full support 10 Full support 10 Prefixed' Implemented with the vendor prefix: MS |
Opera
No support No |
Safari
No support No |
WebView Android No support 3 — ≤37 No support 3 — ≤37 Prefixed' Implemented with the vendor prefix: WebKit |
Chrome Android No support 18 — 25 No support 18 — 25 Prefixed' Implemented with the vendor prefix: WebKit |
Firefox Android No support 6 — 18 No support 6 — 18 Prefixed' Implemented with the vendor prefix: Moz
Notes' Starting in Firefox 14, using |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android No support 1.0 — 1.5 No support 1.0 — 1.5 Prefixed' Implemented with the vendor prefix: WebKit |
Legend
- Full support
- Full support
- No support
- No support
- Non-standard. Expect poor cross-browser support.'
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.'
- Deprecated. Not for use in new websites.
- See implementation notes.'
- See implementation notes.
- Requires a vendor prefix or different name for use.'
- Requires a vendor prefix or different name for use.
See also
BlobBuilder by Mozilla Contributors is licensed under CC-BY-SA 2.5.