Skip to content

Commit

Permalink
use shorthand event listener syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
caged committed Sep 25, 2010
1 parent 81cd9a6 commit 9196342
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
Non-blocking, streaming CSV parser.
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.
Expand Down
4 changes: 2 additions & 2 deletions lib/ecsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ exports.each = function(file, callback, finalize, opts) {
function parse() {
var stream = fs.createReadStream(file)
stream.setEncoding('utf8')
stream.addListener('data', function(data) {
stream.on('data', function(data) {
buffer += data
var lines = buffer.split(crlf)

Expand Down Expand Up @@ -79,7 +79,7 @@ exports.each = function(file, callback, finalize, opts) {
rows += lines.length - 1;
})

stream.addListener('close', function() {
stream.on('close', function() {
if(!options.headers) rows += 1
if(finalize) finalize(rows)
})
Expand Down

0 comments on commit 9196342

Please sign in to comment.