Re: [whatwg/streams] Fix readable byte stream example (#1080)

@nidhijaju commented on this pull request.



> -   .catch(e => console.error("Something went wrong!", e));
-
- function readInto(buffer, offset = 0) {
-   if (offset === buffer.byteLength) {
-     return Promise.resolve(buffer);
-   }
+ const buffer = await readInto(startingAB);
+ console.log("The first 1024 bytes: ", buffer);
+
+ async function readInto(buffer) {
+   let offset = 0;
+   let view;
+   let done;
+
+   do {
+     ({value: view, done} =

That makes sense, I've just added your suggestion in my last commit. Thank you for taking a look and the suggestions as well! 😃

-- 
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/1080#discussion_r513133413

Received on Wednesday, 28 October 2020 01:56:06 UTC