Skip to content

What should we call ReadableByteStream.prototype.getBYOBReader()? #294

@domenic

Description

@domenic

Per the lengthy discussions in #253 the new shape of ReadableByteStream will be something like:

  • getReader() returns a reader that, much like the "normal" ReadableStream, has automatically flowing auto-allocated chunks. So, rbs.getReader().read() will take no arguments and will auto-allocate a new Uint8Array each call.
  • Some other function, with straw-person name getBYOBReader(), returns a reader that requires you to feed it buffers. So, you call rbs.getBYOBReader().read(myBuffer) and it reads into myBuffer. (After doing appropriate detaching/transferring to ensure no observable data races, etc., as discussed extensively in Support reading bytes into buffers allocated by user code on platforms where only async read is available #253 and elsewhere.)

Here "BYOB" stands for "bring your own buffer," by the way.

Ideas for names:

  • getBYOBReader()
  • getManualReader()
  • getBufferedReader()
  • getFedReader()
  • getManualFeedReader()
  • getControlledAllocationReader()
  • getReadIntoReader()
  • getBytesReader() (although the normal reader also gives you bytes)
  • getPullingReader() (referring to how generally no reading is done until you call read(view), i.e. data is "pulled")
  • getReader({ feedBuffers: true }) or similar (introduces some kinda-strange return type variance though)

Are there any precedents from other platforms we can draw on, just for vocabulary if nothing else?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions