1.1.0 • Published 9 years ago

nodecsv v1.1.0

Weekly downloads
5
License
ISC
Repository
github
Last release
9 years ago

nodecsv

This is a simple library to read and write csv.

https://github.com/yetsun/nodecsv

Usage

Installation command is npm install nodecsv.

Read CSV example

var readCSV = require('nodecsv').readCSV;

readCSV('./csv_sample.csv', function(error, data){
  //data is a array of array
  //if csv_sample.csv is like this:
  //1,2,3
  //4,5,6
  //data will be:
  //[ [ '1', ' 2', ' 3' ], [ '4', ' 5', ' 6' ] ]
  console.log(data);
});

Write CSV example

var writeCSV = require('nodecsv').writeCSV;

//output.csv will be like:
//1,2,3
//4,5,6
writeCSV('./output.csv', [ [ '1', ' 2', ' 3' ], [ '4', ' 5', ' 6' ] ], function(error){
  console.log(error);
});

Append CSV example

var appendCSV = require('nodecsv').appendCSV;

//similar to writeCSV. appendCSV will append, of course.
appendCSV('./output.csv', [ [ '1', ' 2', ' 3' ], [ '4', ' 5', ' 6' ] ], function(error){
  console.log(error);
});

appendCSVSync: the sync version of appendCSV

1.1.0

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago