-
Notifications
You must be signed in to change notification settings - Fork 27
Async iterators #53
Comments
As an example of what let body = '';
for await(const data on req) body += data;
const parsed = JSON.parse(body); // note that we can let errors propagate, since we're in an async fn
console.log("got", parsed); |
@benjamingr as recent events played for the multiple inheritance, I have nothing opposing From an implementation perspective, there are probably some lines of code involved. However, is this a CTC issue? Can we work on this through issues/PR? |
This would just mean adding a I'll open a separate issue for |
This has been addressed in nodejs/readable-stream. Thanks everyone! |
Hey,
Async iterators are a stage 3 proposal for asynchronous pull streams (link) with a v8 implementation arriving very soon.
Async iterators and the new
for await... of
loop are coming our way. I'd like to bring that up for discussion for several reasons.Symbol.asyncIterator
is introduced. I believestream.Readable
should supportSymbol.asyncIteator
which would allow it to be iterated withfor...await
. Note that since async iterators are pull streams backpressure sounds fairly easy to do. cc @nodejs/streamsThe text was updated successfully, but these errors were encountered: