GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

ReadableStreamBYOBReader: ReadableStreamBYOBReader() constructor

Streams

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

```js-nolint
new ReadableStreamBYOBReader(stream)
```

### Parameters

- `stream`
- : The ReadableStream to be read.

### Return value

An instance of the ReadableStreamBYOBReader object.

### Exceptions

- TypeError
- : Thrown if the supplied `stream` parameter is not a ReadableStream, or it is already locked for reading by another reader, or its stream controller is not a ReadableByteStreamController.

## Examples

The constructor is rarely called directly.
Instead call ReadableStream.getReader() as shown:

```js
const reader = stream.getReader({ mode: "byob" });
```

## Specifications

## Browser compatibility

## See also

- ReadableStreamBYOBReader
- [Using readable byte stream](/docs/Web/API/Streams_API/Using_readable_byte_streams)

source: MDN Web Docs mirror · page

Cite this

"ReadableStreamBYOBReader: ReadableStreamBYOBReader() constructor". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/ReadableStreamBYOBReader

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·