Blob 接口的 stream() 方法返回 ReadableStream which upon reading returns the data contained within the Blob .

句法

var stream = blob.stream();
					

参数

None.

返回

A ReadableStream which, upon reading, returns the contents of the Blob .

用法注意事项

采用 stream() and the returned ReadableStream , you gain several interesting capabilities:

  • 调用 getReader() on the returned stream to get an object to use to read the data from the blob using methods such as the ReadableStreamDefaultReader 接口的 read() 方法。
  • Call the returned stream's pipeTo() method to pipe the blob's data to a writable stream.
  • Call the returned stream's tee() 方法到 tee the readable stream. This returns an array containing two new ReadableStream objects, each of which returns the contents of the Blob .
  • Call the returned stream's pipeThrough() method to pipe the stream through a TransformStream or any other readable and writable pair.

规范

规范 状态 注释
文件 API
The definition of 'Blob.stream()' in that specification.
工作草案

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
stream() Chrome 76 Edge 79 Firefox 69 IE No Opera No Safari No WebView Android 76 Chrome Android 76 Firefox Android No Opera Android 54 Safari iOS No Samsung Internet Android 12.0

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: