BlobBuilder - Web API 接口参考 编辑
已废弃
该特性已经从 Web 标准中删除,虽然一些浏览器目前仍然支持它,但也许会在未来的某个时间停止支持,请尽量不要使用该特性。
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
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.
BlobBuilder
接口已经废弃,请使用新版草案中引入的 Blob
构造函数.方法概述
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); |
方法
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 );
参数
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 可选 );
参数
- contentType 可选
- The MIME type of the data to be returned in the
Blob
. This will be the value of theBlob
object's type property.
返回值
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()
返回一个File
对象.
File getFile( in DOMString name, [optional] in DOMString contentType );
参数
- name
- 文件名.
- contentType 可选
- 设置返回的
File
对象中的数据的MIME类型.这个值将会成为返回的File
对象的type属性的值.
返回值
一个File
对象.
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 8 As WebKitBlobBuilder † | 6.0 (6.0) As MozBlobBuilder | 10 As MSBlobBuilder | 未实现 | 未实现† |
getfile() | 未实现 | 8.0 (8.0) | 未实现 | 未实现 | 未实现 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 3 As WebKitBlobBuilder | 6.0 (6.0) As MozBlobBuilder | 未实现 | 未实现 | 未实现 |
getfile() | 未实现 | 8.0 (8.0) | 未实现 | 未实现 | 未实现 |
注:BlobBuilder已被废弃
- 从Firefox 14开始,使用
MozBlobBuilder
会在Web控制台显示一条警告消息:MozBlobBuilder
已被废弃,请使用Blob
来代替. - 从Firefox 18开始,
MozBlobBuilder
已被删除. - WebKit has deprecated
WebKitBlobBuilder
and has made its support configurable. Currently Safari disables the feature in Nightly, so it will never likely to ship in the final version. On the other hand, Chrome, which has supported it since Chrome 8, still enables the feature. So Chrome might continue to support the feature. (See this WebKit changeset for details).
相关链接
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论