-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Description
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 newUint8Arrayeach call.- Some other function, with straw-person name
getBYOBReader(), returns a reader that requires you to feed it buffers. So, you callrbs.getBYOBReader().read(myBuffer)and it reads intomyBuffer. (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 callread(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?