Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Blob()

翻譯不完整。請協助 翻譯此英文文件

Blob() 建構式會回傳一個新建立的 Blob 物件。新物件的內容是由 array 參數的成員值串連所構成。

語法

var aBlob = new Blob( array, options );

參數

  • array 可以是一個由 ArrayBufferArrayBufferViewBlob 或 DOMString 組成的 Array 物件,或是上述多種型別物件的混合陣列。這個陣列將會被放進新建立的 Blob 物件當中。
  • options 是選擇性的 BlobPropertyBag 字典物件,有以下兩個指定的屬性:
    • type 屬性,預設值為空字串 "",表示將被放進 Blob 物件的陣列內容之 MIME 類型。
    • endings 屬性,表示包含 \n 換行字元的字串要如何輸出,預設值為字串 "transparent"。此屬性值可為:"native",代表換行字元會被轉為目前作業系統的換行字元編碼。也可以是 "transparent",代表保留 Blob 物件中資料的換行字元。

範例

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
The definition of 'Blob()' in that specification.
Working Draft Initial definition.

瀏覽器相容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 20 13.0 (13.0) [1] 10 12.10 8
in Workers ? 14.0 (14.0) ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 13.0 (13.0) [1] No support ? ?
in Workers ? 14.0 (14.0) No support ? ?

[1] Before Firefox 16, the second parameter, when set to null or undefined, leads to an error instead of being handled as an empty dictionary.

參見

  • The deprecated BlobBuilder which this constructor replaces.

 

文件標籤與貢獻者

 此頁面的貢獻者: jackblackevo
 最近更新: jackblackevo,