- From: Sina Booeshaghi <notifications@github.com>
- Date: Wed, 24 Mar 2021 12:13:13 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 24 March 2021 19:13:27 UTC
Hi! Thanks for all of the work in supporting this API. I would like some help clarifying the `ReadableStreamDefaultReader.read()` return values. In the [Streams specification](https://streams.spec.whatwg.org/) the `ReadableStreamDefaultReader.read()` returns a `{ value, done }` where `done = false` until the [close step](https://streams.spec.whatwg.org/#read-request-close-steps) where there are no more chunks *and* the stream is closed; this makes `done = true`. However the [Mozilla documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader) on the `ReadableStreamDefaultReader.read()` appears to indicate that `done` will change from `false` to `true` when "the stream has already given you all its data" and does not specify that the stream must be closed. My limited experience working with streams (using `Google Chrome Version 89.0.4389.90 (Official Build) (x86_64)` ) indicates that `done` will only return true if the stream is closed, though I believe that returning `done = true` when there are no more chunks (keeping the stream open) may be a more intuitive design choice. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/1117
Received on Wednesday, 24 March 2021 19:13:27 UTC