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()
方法。
pipeTo()
method to pipe the blob's data to a writable stream.
tee()
方法到
tee
the readable stream. This returns an array containing two new
ReadableStream
objects, each of which returns the contents of the
Blob
.
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. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
不支持
Blob
arrayBuffer()
slice()
stream()
text()