https://github.com/caged/ecsv
This project has been replaced by http://github.com/wdavidw/node-csv-parser
https://github.com/caged/ecsv
Last synced: over 1 year ago
JSON representation
This project has been replaced by http://github.com/wdavidw/node-csv-parser
- Host: GitHub
- URL: https://github.com/caged/ecsv
- Owner: caged
- Created: 2010-09-25T06:06:19.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-09-25T20:13:35.000Z (over 15 years ago)
- Last Synced: 2025-01-20T10:48:30.343Z (over 1 year ago)
- Language: JavaScript
- Homepage: http://github.com/Caged/ecsv
- Size: 93.8 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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)