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
ReadableStreamBYOBReader
object instance.
Properties
-
ReadableStreamBYOBReader.closed
Read only -
Returns a
Promise
that 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
Promise
that resolves when the stream is canceled. Calling this method signals a loss of interest in the stream by a consumer. The suppliedreason
argument will be given to the underlying source, which may or may not use it. ReadableStreamBYOBReader.read()
-
Returns a
Promise
that 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