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

headers event is not fired #329

Closed
1 of 2 tasks
russgove opened this issue Feb 17, 2020 · 6 comments
Closed
1 of 2 tasks

headers event is not fired #329

russgove opened this issue Feb 17, 2020 · 6 comments
Assignees
Labels

Comments

@russgove
Copy link

russgove commented Feb 17, 2020

Describe the bug
The headers event is not fired

Parsing or Formatting?

  • Formatting
  • Parsing

To Reproduce
Steps to reproduce the behavior:

let fileStream = fs.createReadStream(fileName);
let csvStream: any = csv.parseStream(fileStream, {  })
csvStream
  .on("headers",function(headers:any){ // not gerring called. should validate column names up front
    csvStream.pause();
    cmd.log(headers);
    csvStream.resume();
  }) 

Expected behavior
I expect the headers to be logged, but the .on("headers" function is never called

Screenshots

Desktop (please complete the following information):

  • OS: Windows
  • OS Version 10
  • Node Version v8.14.0

Additional context
i am using package "@fast-csv/parse": "4.1.0",

@doug-martin
Copy link
Contributor

doug-martin commented Feb 17, 2020

Try setting headers option set to true

csv.parseStream(fileStream, { headers: true })

@russgove
Copy link
Author

russgove commented Feb 17, 2020 via email

@doug-martin
Copy link
Contributor

Can you please post a sample CSV, so I can try to recreate?

@russgove
Copy link
Author

Thanks for the quick reply! Heres my sample csv
"Title","Apersonq"
"Test1",1
"Test2","2S"
"Test33","3"

@doug-martin
Copy link
Contributor

So I found the issue...it was when publishing to npm I didnt have a prepare step to rebuild the code.

I tested with v4.1.1 and it worked as expected.

@russgove
Copy link
Author

works great, THANKS!

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

No branches or pull requests

3 participants