最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to validate a csv file in node.js? - Stack Overflow

programmeradmin0浏览0评论

I have a large csv file that I need to convert to json, and then store the data into neo4j. I am using the csv-parser plugin for node.js. This works fine if the csv is valid. However if it's not valid, then the data in neo4j gets scrambled. Therefore I need to validate the file, before I can send it into my database. Are there any existing plugins available or is there a way for me to validate the csv file myself?

I have a large csv file that I need to convert to json, and then store the data into neo4j. I am using the csv-parser plugin for node.js. This works fine if the csv is valid. However if it's not valid, then the data in neo4j gets scrambled. Therefore I need to validate the file, before I can send it into my database. Are there any existing plugins available or is there a way for me to validate the csv file myself?

Share Improve this question asked Jul 6, 2016 at 19:12 Sonu KapoorSonu Kapoor 1,6374 gold badges18 silver badges34 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 5

You might look into checking out the API for csvlint

I also suggest checking out this similar answer. (Below this answer also has good csvlint info, too)

There is also fast-csv which has some validation built in, which may help depending on your needs.

Otherwise, finding a validator that caters to your specific needs may be difficult, and I suggest writing editing your node script to validate it for yourself.


Update: I would also like to remend Papa Parse, which has several parsing options.

发布评论

评论列表(0)

  1. 暂无评论