Re: [whatwg/streams] ReadableStreamBYOBReader.prototype.readFully(view) (#1143)

`minBytes` might not be the best name if you're reading into a multi-byte typed array, since you want to reason about `view.length` instead of `view.byteLength`. Maybe `atLeast` works better?
```javascript
const { done, value } = reader.read(new Uint16Array(8), { atLeast: 2 });
// value.length will be between 2 and 8
// value.byteLength will be between 4 and 16 bytes
```

Anyway, it turns out that we can fairly easily generalize the `fill(view)` implementation from #1145 to support "read at least" semantics. I've already got it working [on a separate branch](https://github.com/MattiasBuelens/streams/compare/rs-byob-read-fully...rs-byob-read-at-least). 😁

So, if we're happy with the approach and decide on an API, I can merge that branch into #1145 and we continue from there (update spec text, add tests,...). 🙂

-- 
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/1143#issuecomment-943772486

Received on Thursday, 14 October 2021 22:06:26 UTC