adaltas / adaltas/node-csv

Question: Is it possible to return raw record even for error rows in csv-parse?

Open
#292 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
4.3k
Forks
299
Avg merge
16h 19m
Merged PRs (30d)
1

Description

Usecase
We want to collect raw record and error reason for all the error rows and form a new CSV file out of it.
By giving this CSV file to the end user they can refer the error message and correct the rows and re-upload the same file.

Whats possible today?
'skip_lines_with_error: true' -- we are able to gather the row numbers of all the faulty records.
'raw: true' -- gives raw record only for valid rows

Current implementation emits a 'skip' event as soon as it finds an error.
Is it possible to wait for the iterator to reach the end of the row and emit the event along with raw record?
@wdavidw Do you see any other way to achieve this use-case with the current implementation?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the csv-parse behavior described for skip_lines_with_error, raw, and the skip event. Determine whether an error row can be retained through the end of the row and emitted with its raw record; done means raw records and error reasons are available for all faulty rows without losing valid-row behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.