mafintosh / csv-parser

Streaming csv parser inspired by binary-csv that aims to be faster than everyone else
MIT License
1.41k stars 134 forks source link

skipLines from-to #185

Closed LMJayasundara closed 3 years ago

LMJayasundara commented 3 years ago

Good job nice library ever made for Node.js, Thank you.

I have some smaller questions. How to skip specific lines using this library

Ex when I have 100 lines of CSV How to skip the last 20 lines or skip from 80 to 100

Can anyone give an idea Thank you

shellscape commented 3 years ago

Keep count in the data handler. https://github.com/mafintosh/csv-parser#data

shellscape commented 3 years ago

I would suggest trying an online bootcamp or a Nice fundamentals course from Wes Bos.

conartist6 commented 3 years ago

If you don't know Javascript this is probably not the parser you want. You want this. It will be much easier to work with, and you can just write records.slice(80, 100) if that's what you need.

LMJayasundara commented 3 years ago

Keep count in the data handler. https://github.com/mafintosh/csv-parser#data

It is not suitable have to add slice function to lib like this

fs.createReadStream('data.csv')
  .pipe(csv({
       slice(80, 100)
    }))