csv-stream - Simple CSV stream for node.js
Install
npm install csv-stream
Usage
var csv = require('csv-stream'),
var request = require('request');
var options = {
delimiter : '\t',
endLine : '\n',
columns : ['columnName1', 'columnName2'],
columnOffset : 2,
escapeChar : '"',
enclosedChar : '"'
}
var csvStream = csv.createStream(options);
request('http://mycsv.com/file.csv').pipe(csvStream)
.on('error',function(err){
console.error(err);
})
.on('header', function(columns) {
console.log(columns);
})
.on('data',function(data){
console.log(data);
})
.on('column',function(key,value){
console.log('#' + key + ' = ' + value);
})
Test
npm test
Contributions
Feel free to post issues and pull requests, more than welcome you are ;).
Licence
(The MIT License) Copyright 2012 HipSnip Limited