I was recently asked by someone to give an example of how to read a csv file in their node.js application, and how to parse it to get it to be usable in their app. In fact what they wanted to do is very simple, and it is one of the many reasons I'm a big fan of Node.js, because not only can it do things like this in a few lines of JavaScript, it does it server side, and fast. So This article lays out step by step how to have node.js read and parse a CSV file stored in it's project, by using the CSV module.
Prerequisites:
- Have a node.js development environment. If you need a guide to set this up, you should look at the node documentation as it gives an easy tutorial to do so. If you're looking for a good tutorial, check this one out by the people at @codeship: The Absolute Beginner's Guide to Node.js
- A Text Editor. I currently use vsCode, Atom and Sublime interchangeably