Skip to content
Browse files

Release v0.0.4

  • Loading branch information...
1 parent d12d4f9 commit f7a410fa044ceb8f538dac7f7019e69b4086c04c @pgte committed Nov 22, 2010
Showing with 6 additions and 2 deletions.
  1. +5 −1 lib/carrier.js
  2. +1 −1 package.json
View
6 lib/carrier.js
@@ -10,29 +10,33 @@ function Carrier(reader, listener, encoding) {
self.addListener('line', listener);
}
- line = '';
+ var line = '';
reader.on('data', function(data) {
var decoded = data.toString(encoding);
+ //console.log(decoded);
var lines = decoded.split("\n");
if (decoded.charAt(decoded.length - 1) == "\n") {
// get rid of last "" after last "\n"
lines.pop(1);
}
if (lines.length > 0) {
+ //console.log('Have ' + lines.length + " lines\n");
lines.forEach(function(one_line, index) {
line += one_line;
var emit = true;
if (index == lines.length - 1) {
// processing last line
if (decoded.charAt(decoded.length - 1) != "\n") {
// if it was not terminated by "\n" then the last line was not finished; we just buffer it.
+ //console.log('last one does not have \n, not emitting');
emit = false;
}
}
if (emit) {
line = line.replace("\r", '');
+ //console.log('emiting ' + line + "\n");
self.emit('line', line);
line = '';
}
View
2 package.json
@@ -1,6 +1,6 @@
{ "name" : "carrier"
, "description" : "Evented stream line reader for node.js"
-, "version" : "0.0.3"
+, "version" : "0.0.4"
, "homepage" : "http://github.com/pgte/carrier"
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com> (http://www.metaduck.com)"
, "contributors" :

0 comments on commit f7a410f

Please sign in to comment.
Something went wrong with that request. Please try again.