Blob()
Конструктор Blob()
возвращает новый объект Blob
. Содержимое blob состоит из объединённых значений, переданных в параметре array.
Синтаксис
var aBlob = new Blob( array, options );
Параметры
- array - массив
Array
из объектовArrayBuffer
,ArrayBufferView
(en-US),Blob
,DOMString
, или смесь любых из подобных объектов, которая может быть размещена внутриBlob
. DOMStrings представлены в кодировке UTF-8. - options is an optional
BlobPropertyBag
dictionary which may specify the following two attributes:type
, with a default value of""
, that represents the MIME type of the content of the array that will be put in the blob.endings
, with a default value of"transparent"
, that specifies how strings containing the line ending character\n
are to be written out. It is one of the two values:"native"
, meaning that line ending characters are changed to match host OS filesystem convention, or"transparent"
, meaning that endings are stored in the blob without change. Non-standard
Пример
var aFileParts = ['<a id="a"><b id="b">hey!</b></a>']; // an array consisting of a single DOMString
var oMyBlob = new Blob(aFileParts, {type : 'text/html'}); // the blob
Спецификация
Specification | Status | Comment |
---|---|---|
File API Определение 'Blob()' в этой спецификации. |
Рабочий черновик | Initial definition. |
Браузерная совместимость
BCD tables only load in the browser
See also
- The deprecated
BlobBuilder
(en-US) which this constructor replaces.