ReadableStreamBYOBReader
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The ReadableStreamBYOBReader interface of the Streams API represents a BYOB ("bring your own buffer") reader that can be used to read stream data supplied by the developer (e.g. a custom ReadableStream() constructor).
Constructor
ReadableStreamBYOBReader()-
Creates and returns a
ReadableStreamBYOBReaderobject instance.
Properties
-
ReadableStreamBYOBReader.closedRead only -
Returns a
Promisethat fulfills when the stream closes or the reader's lock is released, or rejects if the stream throws an error. This property enables you to write code that responds to an end to the streaming process.
Methods
ReadableStreamBYOBReader.cancel()-
Returns a
Promisethat resolves when the stream is canceled. Calling this method signals a loss of interest in the stream by a consumer. The suppliedreasonargument will be given to the underlying source, which may or may not use it. ReadableStreamBYOBReader.read()-
Returns a
Promisethat resolves with an object indicating the state of the stream: either the next chunk in the stream or an indication that the stream is closed. ReadableStreamBYOBReader.releaseLock()-
Releases the reader's lock on the stream.
Examples
TBD.
Specifications
| Specification |
|---|
| Streams Standard (Streams) # byob-reader-class |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
ReadableStreamBYOBReader |
89 |
89 |
No
See bug 1604037.
|
No |
No |
No |
89 |
89 |
No |
No |
No |
15.0 |
ReadableStreamBYOBReader |
89 |
89 |
No
See bug 1604037.
|
No |
No |
No |
89 |
89 |
No |
No |
No |
15.0 |
cancel |
89 |
89 |
No
See bug 1604037.
|
No |
No |
No |
89 |
89 |
No |
No |
No |
15.0 |
closed |
89 |
89 |
No
See bug 1604037.
|
No |
No |
No |
89 |
89 |
No |
No |
No |
15.0 |
read |
89 |
89 |
No
See bug 1604037.
|
No |
No |
No |
89 |
89 |
No |
No |
No |
15.0 |
releaseLock |
89 |
89 |
No
See bug 1604037.
|
No |
No |
No |
89 |
89 |
No |
No |
No |
15.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader