-
-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
- Operating System: Linux
- Node Version: 19
- NPM Version: 8
- csv-parser Version: 3.0.0
Expected Behavior
end event headers before executing writable
Actual Behavior
when there is async/await in the headers event, the next pipe is executed before finalizing event headers
How Do We Reproduce?
const readableStreamFile = fs.createReadStream('big.csv')
const writableStreamFile = new Writable({
objectMode: true,
async write(chunk, encoding, next) {
console.log('writable')
next()
}
})
readableStreamFile
.pipe(csv())
.on('headers', async (headers) => {
console.log('before headers')
for await () {}
// or
await fecth()
console.log('after headers')
})
.pipe(writableStreamFile)
// the output will be:
// before headers
// writable
// after headersMy dream is to arrive at the writable with all the headers event code finalized.
Metadata
Metadata
Assignees
Labels
No labels