Streams
The ReadableStreamBYOBReader() constructor creates and returns a ReadableStreamBYOBReader object instance.
[!NOTE] You generally wouldn't use this constructor manually; instead, you'd use the ReadableStream.getReader() method with the argument
"byob".
Syntax
new ReadableStreamBYOBReader(stream)
Parameters
stream- : The ReadableStream to be read.
Return value
An instance of the ReadableStreamBYOBReader object.
Exceptions
- TypeError
- : Thrown if the supplied
streamparameter is not a ReadableStream, or it is already locked for reading by another reader, or its stream controller is not a ReadableByteStreamController.
- : Thrown if the supplied
Examples
The constructor is rarely called directly. Instead call ReadableStream.getReader() as shown:
const reader = stream.getReader({ mode: "byob" });
Specifications
Browser compatibility
See also
- ReadableStreamBYOBReader
- Using readable byte stream
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
