Skip to content
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
lib
tests
README.md
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.