Describe the bug
When we upgraded from [email protected] to version >=6.1.0, our csv parsing logic broke.
We use from_line in our logic depending on the file.
We noticed that in [email protected], Parser.options.columns used to be set to something that looks like:
[
{ name: 'invoiceReference' },
{ name: 'sequenceNumber' },
{ name: 'providerNumber' },
...
]
Which works for any value that is set for from_line.
However in 6.1.0+, when you set from_line >= 2, Parser.options.columns becomes:
To Reproduce
I believe this also needs a CSV file with a BOM char.
Example:
const csvIterator = Fs.createReadStream(localFilePath).pipe(
CsvParser({
columns: true,
trim: true,
bom: true,
from_line: 2
})
);
for await (let record of csvIterator) {
console.log(csvIterator.options?.columns); // will log out 'true'
}
Additional context
It looks like we can use another field Parser.api.options.columns. This is set correctly for all scenarios.
But hopefully this might help someone who had the same issue.
Describe the bug
When we upgraded from [email protected] to version >=6.1.0, our csv parsing logic broke.
We use
from_linein our logic depending on the file.We noticed that in [email protected],
Parser.options.columnsused to be set to something that looks like:Which works for any value that is set for
from_line.However in 6.1.0+, when you set
from_line>= 2,Parser.options.columnsbecomes:To Reproduce
I believe this also needs a CSV file with a BOM char.
Example:
Additional context
It looks like we can use another field
Parser.api.options.columns. This is set correctly for all scenarios.But hopefully this might help someone who had the same issue.