Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 tests
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

Streaming CSV parser.

Beyond the basics, ecsv supports:

  • Custom quote characters
  • Custom separator
  • Headers in separate file

FAST

Parses about 24,700 rows per second in my rudimentary tests.

HOW TO USE

require 'ecsv'

// Basic Parsing
ecsv.each('myfile.csv', function(item, idx) {
  sys.puts(sys.inspect(item))
}, null, { headers: true})


// Special quote character
ecsv.each('cands10.csv', function(item) {
  sys.puts(sys.inspect(item))
}, finalize, { headers: true, quoteChar: '|'})


// Headers in separate file (one header per each line)
ecsv.each('indivs10.csv', function(item) {
  // sys.puts(sys.inspect(item))
},  finalize, { headerFile: 'headers.txt', quoteChar: '|'})

TODO

  • Upgrade the limited test suite to use one of the newer testing frameworks.
  • Look into going the EventEmitter route

    ecsv.parse(file) .on('row', fn) .on('end', fn)

Something went wrong with that request. Please try again.