ReadableStream DefaultReader
Last updated Apr 23, 2026
Background
A reader is used when you want to read from a ReadableStream, rather than piping its output to a WritableStream.
A ReadableStreamDefaultReader is not instantiated via its constructor. Rather, it is retrieved from a ReadableStream:
const { readable, writable } = new TransformStream();
const reader = readable.getReader();
Properties
reader.closed: Promise- A promise indicating if the reader is closed. The promise is fulfilled when the reader stream closes and is rejected if there is an error in the stream.
Methods
read(): Promise- A promise that returns the next available chunk of data being passed through the reader queue.
cancel(reasonstringoptional): void- Cancels the stream.
reasonis an optional human-readable string indicating the reason for cancellation.reasonwill be passed to the underlying source’s cancel algorithm -- if this readable stream is one side of aTransformStream, then its cancel algorithm causes the transform’s writable side to become errored withreason.
Warning
Any data not yet read is lost.
- releaseLock() : void
- Releases the lock on the readable stream. A lock cannot be released if the reader has pending read operations. A TypeError is thrown and the reader remains locked.
Related resources
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers/runtime-apis/streams/readablestreamdefaultreader/#page","headline":"ReadableStream DefaultReader","description":"Use ReadableStreamDefaultReader in Workers to read chunks from a ReadableStream.","url":"https://developers.cloudflare.com/workers/runtime-apis/streams/readablestreamdefaultreader/","inLanguage":"en","image":"https://developers.cloudflare.com/workers/runtime-apis/streams/readablestreamdefaultreader/og.png?v=814ce8e246aeefb8","dateModified":"2026-04-23","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Use the TransformStream API in Workers to pipe data between readable and writable streams. title: TransformStream image: https://developers.cloudflare.com/workers/runtime-apis/streams/transformstream/og.png?v=adec614fb8301ed3
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workers/llms.txt
Use this file to discover all available pages before exploring further.
Docs