Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Note: This feature is available in Web Workers.
The read() method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.
None.
A Promise, which fulfills/rejects with a result depending on the state of the stream. The different possibilities are as follows:
The source object is not a ReadableStreamDefaultReader, the stream has no owner, or ReadableStreamDefaultReader.releaseLock() is called (when there's a pending read request).
This example shows the basic API usage, but doesn't try to deal with complications like stream chunks not ending on line boundaries for example.
In this example, stream is a previously-created custom ReadableStream. It is read using a ReadableStreamDefaultReader created using getReader(). (see our Simple random stream example for the full code). Each chunk is read sequentially and output to the UI as an array of UTF-8 bytes, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the UI.
This example shows how you might fetch a text file and handle it as a stream of text lines. It deals with stream chunks not ending on line boundaries, and with converting from Uint8Array to strings.
| Streams # ref-for-default-reader-read① |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Sep 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.