Skip to content

Instantly share code, notes, and snippets.

@jbeuckm
Created November 4, 2016 19:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbeuckm/5d3035072634740513747c5066a02c53 to your computer and use it in GitHub Desktop.
Save jbeuckm/5d3035072634740513747c5066a02c53 to your computer and use it in GitHub Desktop.
A quick nodejs filter to process a CSV file.
var fs = require('fs');
var csv = require('csv');
var md4 = require('js-md4');
fs.createReadStream(__dirname+'/input.csv')
.pipe(csv.parse({columns: true}))
.pipe(csv.transform(function(record){
record.my_field = md4(record.my_field);
return record;
}))
.pipe(csv.stringify({ header: true }))
.pipe(process.stdout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment