-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking bug and discussion for asynchronous iteration in Node.js core #15709
Comments
Personally, I would look forward to a core way to read and process big files line by line in async/await functions without complicated Promise chains in event callbacks. I understand this is not the main purpose of streams, but everybody loves |
I'm not super familiar with async iterators but this seems like something we'd definitely want to investigate further. |
AsyncIterator landed in Chrome and V9 will likely ship support. @nodejs/streams @nodejs/collaborators I would love it if this issue made it to TSC agenda and discussed at the next meeting - I think adding experimental |
I don't know if I'll have time for a pull request but if somebody wants to use the module I wrote as the basis for adding them to streams you have my permission to do so without worrying about the license. |
I don't think that placing them under a flag is helpful. I would just emit an experimental warning when using them for the first time. |
@mcollina you're right, an experimental morning should be sufficient. |
I'm working on an implementation of this, and it is not clear when |
I've been playing with this a little bit in the fs promises implementation, specifically in a promise-based |
Adds support for Symbol.asyncIterator into the Readable class. Fixes: nodejs#15709
Adds support for Symbol.asyncIterator into the Readable class. The stream is destroyed when the loop terminates with break or throw. Fixes: nodejs#15709
Hey. I want to chip in for any Node.js users like myself, playing along at home, about how to use async generators in Node.js: that information was a little scattered, and I wasn't sure what the status was myself.
Thank you Node team and V8 implementer Caitlin Potter. This is such a great improvement to JavaScript. |
Asynchronous iteration has landed in V8 6.3 , so we can have it in Node.js v9 at the end of the year.
There are some plans to implement a stream version based on this feature. Since node-eps seems to be archived, maybe it is worth to have an issue for this in the core repository.
Refs:
https://github.com/tc39/proposal-async-iteration
https://tc39.github.io/proposal-async-iteration/
https://bugs.chromium.org/p/v8/issues/detail?id=5855
https://ponyfoo.com/articles/javascript-asynchronous-iteration-proposal
http://2ality.com/2016/10/asynchronous-iteration.html
https://jakearchibald.com/2017/async-iterators-and-generators/
nodejs/CTC#53
nodejs/readable-stream#254
tc39/proposal-async-iteration#74
nodejs/promises#31 (and nodejs/promises#31 (comment))
https://github.com/calvinmetcalf/async-iter-stream
The text was updated successfully, but these errors were encountered: