Skip to content

stream: add a non-destroying iterator to Readable

Add a non-destroying async iterator to Readable.

fixes: https://github.com/nodejs/node/issues/38491

@nodejs/streams

A few things that I think might need attention:

  1. The API itself. Is a new method needed and is the naming OK, or should options be added to Symbol.asyncIterator?
  2. Should the new method receive different defaults than Symbol.asyncIterator?
  3. Maybe unrelated to this PR, should the createAsyncIterator method remove the listeners that it adds after the iteration ends? Currently it does not, but this was done when it essentially always destroyed the stream. Now it does not (although, it would be a bit problematic with Error, as it emits an error next-tick if an error was thrown). I'm not sure if it's that bad, as the listeners are mostly noops anyway.

Merge request reports

Loading