Wilcox Development Solutions Blog

Using the CSV NPM Module

July 21, 2014

Today I had to use the CSV Node Module. It looked like the best and most mature of the alternatives.

The disadvantage about it is that the examples - especially for taking Javascript objects and getting a CSV string out - really leave something to be desired.

To combat this I wrote a simple Node program to illustrate how to write CSV files with the module. Enjoy!

CSV 0.4.0 example

For an example that uses the old - CSV 0.2.0 syntax - see below. Yes, I only provide an example of the callback syntax. You should really upgrade to CSV 0.4.0.

CSV 0.2.0 example