ReadableStream BYOBReader
BYOB is an abbreviation of bring your own buffer. A ReadableStreamBYOBReader allows reading into a developer-supplied buffer, thus minimizing copies.
An instance of ReadableStreamBYOBReader is functionally identical to ReadableStreamDefaultReader with the exception of the read method.
A ReadableStreamBYOBReader is not instantiated via its constructor. Rather, it is retrieved from a ReadableStream:
const { readable, writable } = new TransformStream();const reader = readable.getReader({ mode: 'byob' });-
read(bufferArrayBufferView): Promise<ReadableStreamBYOBReadResult>- Returns a promise with the next available chunk of data read into a passed-in buffer.
-
readAtLeast(minBytes, bufferArrayBufferView): Promise<ReadableStreamBYOBReadResult>- Returns a promise with the next available chunk of data read into a passed-in buffer. The promise will not resolve until at least
minByteshave been read.
- Returns a promise with the next available chunk of data read into a passed-in buffer. The promise will not resolve until at least
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark