changes-stream icon indicating copy to clipboard operation
changes-stream copied to clipboard

Make the stream async-iterable

Open taleinat opened this issue 5 years ago • 0 comments

Since node v10, ReadableStreams are async-iterable, i.e. one can do the following:

for await (const chunk of readable) {
    data += chunk;
}

See the docs for more details.

It would be very convenient to be able to iterate through changes this way:

const ChangesStream = require('changes-stream');

const changes = new ChangesStream({ db: '...' });
for await (const change of changes) {
  ...
}

taleinat avatar Sep 27 '19 18:09 taleinat