Stream into the Future
summary
Argument: replace Node Core Streams with plain JavaScript async iterators and generators, using for await...of to consume streams and readable.from to convert iterators into streams. Demonstrations show Node 10+ support, seven live examples, and that async-iterator code matches stream performance with no measurable penalty. Use pipeline (not .pipe) to auto-tear-down and avoid memory/file-descriptor leaks. Remaining gaps: a transform-from-async-iterator PR is pending and writable-stream->promise semantics (error timing mismatch) are still unresolved.
AI-written summary · about
chapters (24)
- 0:00Introduction and setup
- 1:02What are Node.js streams
- 2:26Stream events and complexity
- 4:11The wild horse problem
- 5:58Push vs pull model
- 7:23Memory leaks with pipe
- 8:45Why not fix pipe
- 9:48Streams and async/await
- 11:12Improving stream usability
- 12:21Async iterators in Node.js
- 14:54Readable.from and testing
- 17:06Demo: Old-school streams
- 18:10Demo: Readable.from
- 19:19Demo: Sync generators
- 20:21Demo: File streams
- 21:52Demo: Async iteration
- 23:21Async/await on the server
- 24:48What’s missing in streams
- 25:54Transform streams with async
- 27:01Writable streams and promises
- 29:06Async iterator internals
- 30:55Performance and edge cases
- 31:36Web streams and compatibility
- 32:40Future of Node.js streams
related talks
33mStream into the Future
23mAsync Iterators: a new future for streams
24mGenerating async iterators is ekstreamly easy, I Promise ;)
28mThe good, the bad and the ugly of nodejs streams
24mAsync and Streaming JS - Are we doing it wrong?
22mFrom Promises through Generators to async/await in node.js
28mWhat happens next: a choose-your-own-adventure with iterators
43mThe Return of Stream I/O
