Re: [whatwg/streams] Add ReadableStreamBYOBReader.readFully() (#1145)

@ricea commented on this pull request.

With regards to the spec, this looks good.

Sorry to show up late with a bikeshed, but I like the name `fill()`. `reader.fill(view)` feels good to me. Disadvantages: no precedent for the name, and it would a nuisance to change all the tests and everything now. It may be to harder to find (but the reader doesn't have so many methods that it would be lost in the noise). I'm just suggesting it to see how others feel.

Regarding implementation in Blink, I think this clearly fixes an ergonomic problem. Some people expect `read()` to work this way already. Implementation is stuck behind #1123 and other things that are higher priority.

> @@ -1382,6 +1392,34 @@ value: newViewOnSameMemory, done: true }</code> for closed streams. If the strea
   <p>If reading a chunk causes the queue to become empty, more data will be pulled from the
   [=underlying source=].
 
+ <dt><code>{ <var ignore>value</var>, <var ignore>done</var> } = await <var ignore>reader</var>.{{ReadableStreamBYOBReader/readFully()|readFully}}(<var ignore>view</var>)</code>
+ <dd>
+  <p>Attempts to read bytes into |view| until it is completely full, and returns a promise resolved
+  with the result:
+
+  <ul>
+   <li>If enough bytes become available to fill |view|, the promise will be fulfilled with an
+   object  of the form <code highlight="js">{ value: theView, done: false }</code>. In this case,

Nit: There's an extra space between "object" and "of".

-- 
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/pull/1145#pullrequestreview-731168793

Received on Monday, 16 August 2021 22:44:35 UTC