changes-stream
changes-stream copied to clipboard
Make the stream async-iterable
Since node v10, ReadableStream
s 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) {
...
}