Cloudflare 中文文档
Workers
Workers
编辑这个页面
跳转官方原文档
Set theme to dark (⇧+D)

ReadableStreamBYOBReader

​​ Background

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:


​​ Methods

  • 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 minBytes have been read.

​​ Common issues