Blob()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since июль 2015 г..
Конструктор Blob()
возвращает новый объект Blob
. Содержимое blob состоит из объединённых значений, переданных в параметре array.
Синтаксис
var aBlob = new Blob( array, options );
Параметры
- array - массив
Array
из объектовArrayBuffer
,ArrayBufferView
,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. Не стандартно
Пример
js
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 |
---|
File API> # constructorBlob> |
Совместимость с браузерами
Loading…
Смотрите также
- The deprecated
BlobBuilder
which this constructor replaces.