Skip to content

Parser.options.columns no longer contains array of column names from csv@6.1.0+ #460

Closed

Description

@richardlay

Describe the bug

When we upgraded from csv@6.0.4 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 csv@6.0.4, 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:

true

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.

Activity

  1. wdavidw commented on Jul 16, 2025

    @wdavidw
    Member

    Hi, I just published csv 6.4.1 and csv-parse 6.1.0 which fix the issue. The problem was associated with bom auto detection

  2. added a commit that references this issue on Oct 6, 2025
    4abcc44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions