I was experimenting with pEvent.iterator
with fs.createReadStream
. See this very simple example:
// what.js
const pEvent = require('p-event');
const fs = require('fs');
(async () => {
try {
console.log('A');
const asyncIterator = pEvent.iterator(fs.createReadStream('.npmrc'), 'data');
console.log('B');
for await (const event of asyncIterator) {
console.log('C', event.toString());
}
console.log('D');
} catch {
console.log('E');
}
})();
Executing node what.js && echo success
gives:
A
B
C package-lock=false
success
It does not log D
nor E
, and even exits with code 0! Do you have any idea what is going on here?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too