Blob()构造方法返回一个新的Blob
对象. 内容是包含参数array的二进制字节流.
var aBlob = new Blob( array, options );
Array
of ArrayBuffer
, ArrayBufferView
, Blob
, DOMString
objects, or a mix of any of such objects, that will be put inside the Blob
. DOMStrings are encoded as UTF-8.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.var buffer = new ArrayBuffer(2); var int8View = new Int8Array(buffer); int8View[0] = 170; int8View[1] = 254; var blob = new Blob([int8View, event.target.result]);
此段代码创建了一个2字节的二进制数10101010和11111110,并且把它追加到了event.target.result字节流的头部
[JavaScript]使用ArrayBuffer和Blob编辑二进制流
原文:http://www.cnblogs.com/yiyide266/p/6351446.html