Re: [whatwg/streams] ReadableStream.from(asyncIterable) (#1083)

@jasnell commented on this pull request.



> @@ -475,6 +481,8 @@ The Web IDL definition for the {{ReadableStream}} class is given as follows:
 interface ReadableStream {
   constructor(optional object underlyingSource, optional QueuingStrategy strategy = {});
 
+  static ReadableStream from(any asyncIterable);

It would be excellent to see this move forward. With regards to the question about the special case for byte sources, the signature here can echo the signature for the `new ReadableStream()` constructor...

```js
const readable1 = ReadableStream.from(iter, new CountQueueingStrategy({ highWaterMark: 10 });

const readable2 = ReadableStream.from({ source: iter, type: 'bytes', autoAllocateChunkSize: 1024 });
```

That is, make the first argument either a dictionary or an iterator...

```
dictionary FromInit {
  (AsyncIterator | Iterator) source;
  ReadableStreamType type;
  unsigned long long autoAllocateChunkSize;
}
```

-- 
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/1083#pullrequestreview-751925951

Received on Saturday, 11 September 2021 15:15:44 UTC