Permalink
Browse files

use shorthand event listener syntax

  • Loading branch information...
1 parent 81cd9a6 commit 91963429c32aa5a40d2f94198744661d7dc93086 @Caged committed Sep 25, 2010
Showing with 8 additions and 3 deletions.
  1. +6 −1 README.md
  2. +2 −2 lib/ecsv.js
View
@@ -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.
View
@@ -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)
@@ -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)
})

0 comments on commit 9196342

Please sign in to comment.