node-csv
node-csv copied to clipboard
When `bom` and `skipRecordsWithError` skip event is not raised for skipped records
Describe the bug
Setting both options results in csv file parsed correctly but no event is fired for skipped lines.
To Reproduce
import { createReadStream } from 'node:fs';
import { finished } from 'node:stream/promises';
import { parse } from 'csv-parse';
const parser = parse({
bom: true,
skipRecordsWithError: true,
});
const outStream = createReadStream('tests/closed-box/fixtures/data-with-bom.csv').pipe(parser);
outStream.on('skip', (e) => {
console.error(e);
});
await finished(outStream);
I would expect the console error to be called but it doesn't. When removing the bom option and using something like strip-bom-stream the event is fired correctly.
Additional context data-with-bom.csv