Re: [streams] How will ReadableByteStream work with seekable resources? (#253)

> Separate question, @tyoshino: in #275 (comment) and #253 (comment) you said you think read(2)-backed ReadableByteStreams will be backed by a one-element queue. I don't quite understand why this would be the case? It seems better to have readInto() (or, maybe, feedArrayBuffer()) directly call to read(2), instead of having the queue.

In the first comment, I introduced `.amountReadable` for I/Os that can tell us how many bytes can be read. I didn't mean that we should call `read(2)` in advance and determine how many bytes can be read. I think for `read(2)` backed stream, I'd return **undefined** on `.amountReadable` call.

In the second comment, I tried to unify interface for `read(2)` backed one and `fread(3)` backed one by using only one method `feedBuffer()`, and I said `feedBuffer()` will put the given buffer to a queue. We can make the ReadableStream's state `"readable"` synchronous to `feedBuffer()` call by completing `read(2)` immediately after the push of the fed buffer to the queue. So, this is equivalent to `readInto()` in terms of efficiency (though cumbersome that we need two steps).

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/253#issuecomment-74817246

Received on Wednesday, 18 February 2015 05:58:42 UTC