Parsing a CSV file using NodeJS

lonelymo picture lonelymo · Apr 15, 2014 · Viewed 254.4k times · Source

With nodejs I want to parse a .csv file of 10000 records and do some operation on each row. I tried using http://www.adaltas.com/projects/node-csv. I couldnt get this to pause at each row. This just reads through all the 10000 records. I need to do the following:

  1. read csv line by line
  2. perform time consuming operation on each line
  3. go to the next line

Can anyone please suggest any alternative ideas here?

Answer

Risto Novik picture Risto Novik · Apr 15, 2014

Seems like you need to use some stream based solution, there existed already such libraries so before reinventing yourself, try this library, which also includes validation support. https://www.npmjs.org/package/fast-csv