JSPM

  • Created
  • Published
  • Downloads 1810486
  • Score
    100M100P100Q216705F

Streaming csv parser inspired by binary-csv that aims to be faster than everyone else

Package Exports

  • csv-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (csv-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

csv-parser

Streaming csv parser inspired by binary-csv that aims to be faster than everyone else

npm install csv-parser

build status dat

Usage

Simply instantiate csv and pump a csv file to it and get the rows out as objects

var csv = require('csv-parser')

fs.createReadStream('some-csv-file.csv')
  .pipe(csv())
  .on('data', function(data) {
    console.log('row', data)
  })

The data emitted is a normalized JSON object

The csv constructor accepts the following options as well

var stream = csv({
  raw: false,    // do not decode to utf-8 strings
  separator: ',' // specify optional cell separator
})

Command line tool

There is also a command line tool available. It will convert csv to line delimited JSON.

npm install -g csv-parser

Open a shell and run

$ csv-parser

To parse a stdin to stdout do

printf "a,b\nc,d\n" | csv-parser -

License

MIT