Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] check Headers on read first row of file CSV #321

Closed
1 of 2 tasks
lytaitruong opened this issue Feb 7, 2020 · 2 comments
Closed
1 of 2 tasks

[FEATURE] check Headers on read first row of file CSV #321

lytaitruong opened this issue Feb 7, 2020 · 2 comments
Assignees

Comments

@lytaitruong
Copy link

  • Formatting
  • Parsing

Describe event:

  • I have the file stream CSV from S3 and I have to read It by your API.
    The file Csv will have:
  1. First row: name & type each column
  2. Second row: Data on each column

The problem is:

  • Instead using event.on('data') to check format the all database, it make i considers when the large row. I want just only using like event.on('headers') to return array first row to handle error before read all database.

Describe the solution you'd like
I see the library like 'csvtojson' or 'csv-parser' they have the event.on('header') to take the array of first row. If have it i can check and response for user the error.csv immediately to they fix
Or can option headers will matching the rule like custom Headers i see
csv.parse({ headers: (header, index) => if(header or index is invalid) => handle this row

Thank for your service

doug-martin added a commit that referenced this issue Feb 14, 2020
* [ADDED] A new `headers` event that will be emitted when headers are parsed #321
@doug-martin doug-martin mentioned this issue Feb 14, 2020
@doug-martin
Copy link
Contributor

Thanks for the feature request! This is published under v4.1.0

@kaustavbhattacharjee
Copy link

Can I use the event.on('headers') in the fromPath function?
Example:

.on('headers',function(d){
        console.log(d);
      })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants