iterator

fun iterator(options: ReadableBaseIteratorOptions = definedExternally): AsyncIterator<Any?>(source)

The iterator created by this method gives users the option to cancel the destruction of the stream if the for await...of loop is exited by return, break, or throw, or if the iterator should destroy the stream if the stream emitted an error during iteration.

Since

v16.3.0

Parameters

options.destroyOnReturn

When set to false, calling return on the async iterator, or exiting a for await...of iteration using a break, return, or throw will not destroy the stream. Default: true.