Re: [whatwg/streams] Add ReadableStreamBYOBReader.read(view, { atLeast }) (#1145)

Updated to use `read(view, { atLeast })` instead of `fill(view)`, as suggested in #1175. This is a more general solution: users can now choose to only fulfill when the view is filled with at least 1 byte, or 2 bytes, or `view.length / 2` bytes, or whatever. With `fill(view)`, it's all or nothing.

We can still introduce `fill(view)` as a shorthand for `read(view, { atLeast: view.length })` if we want to. Happy to discuss. 🙂

Currently, the tests only cover the `atLeast == view.length` case (i.e. the `fill()` use case). I still need to write tests for the more general cases, i.e. where `0 < atLeast <= view.length`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1145#issuecomment-1015909812

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/pull/1145/c1015909812@github.com>

Received on Tuesday, 18 January 2022 23:01:25 UTC