4 ms·
What do you mean they can't be used? I wrote a stream library with an example of how to filter using an async generator here: https://github.com/SocketCluster/w
by jondubois 8y ago
What do you mean they can't be used? I wrote a stream library with an example of how to filter using an async generator here: https://github.com/SocketCluster/writable-async-iterable-stream#consume-a-filtered-stream-using-an-async-generator https://github.com/SocketCluster/writable-async-iterable-str...
Worked perfectly for me on Node.js 10.
- loige 8y agoReadable-streams v3 (https://www.nearform.com/blog/welcome-readable-stream-3/ https://www.nearform.com/blog/welcome-readable-stream-3/) allows you to use async iterators to process streams (`for...await...of` syntax). This is actually in Node.js current, check out stream docs: https://nodejs.org/api/stream.html#stream_readable_symbol_asynciterator https://nodejs.org/api/stream.html#stream_readable_symbol_as...
- jondubois 8y agoI did consider using the Node.js streams at one point but they support a lot of legacy edge cases and are more relevant for I/O than just a simple event stream (which was my use case). My stream library is less than 100 lines of code and only supports asyncIterator interface; also, it supports multiple concurrent consumers; each consuming at its own pace.