库建议:NodeJs读取csv文件 [英] Library Recommendations: NodeJs reading csv file
问题描述
我想使用nodejs解析一个10000条记录的.csv文件,并对每行进行一些操作.我尝试使用 http://www.adaltas.com/projects/node-csv .我无法让它在每一行暂停.这只会读取所有10000条记录.我需要执行以下操作
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
- 逐行读取csv
- 在每条线上执行耗时的操作
- 转到下一行
有人可以在这里提出其他建议吗?
Can anyone please suggest any alternative ideas here?
推荐答案
似乎您需要使用一些基于流的解决方案,已经存在这样的库,因此在重塑自己之前,请尝试使用该库,该库还包括验证支持. https://www.npmjs.org/package/fast-csv
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
这篇关于库建议:NodeJs读取csv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!