Permalink
Browse files

documented constructor options

  • Loading branch information...
1 parent 1415f6a commit 51e8eb4c2c471e86a30570efdc7a8d9c9202c20d @pgte committed Mar 22, 2012
Showing with 17 additions and 2 deletions.
  1. +11 −0 README.markdown
  2. +1 −1 lib/carrier.js
  3. +5 −1 package.json
View
11 README.markdown
@@ -31,3 +31,14 @@ Or, you can also listen to the "line" event on the returned object of carrier.ca
});
});
server.listen(4001);
+
+carrier.carry accepts the following options:
+
+ carrier.carry(reader, listener, encoding, separator)
+
+* reader: the stream reader
+* listener: a "line" event listener function
+* encoding: what encoding to assume. Default: "utf8"
+* separator: what line separator to use. Default: /\r?\n/
+
+All are optional except for the first.
View
2 lib/carrier.js
@@ -16,7 +16,7 @@ function Carrier(reader, listener, encoding, separator) {
var buffer = '';
- reader.setEncoding(encoding || 'utf-8');
+ reader.setEncoding(encoding || 'utf8');
reader.on('data', function(data) {
var lines = (buffer + data).split(separator);
buffer = lines.pop();
View
6 package.json
@@ -1,6 +1,6 @@
{ "name" : "carrier"
, "description" : "Evented stream line reader for node.js"
-, "version" : "0.1.6"
+, "version" : "0.1.7"
, "homepage" : "http://github.com/pgte/carrier"
, "author" :
{
@@ -17,6 +17,10 @@
"name": "Stéphan Kochen"
, "email": "stephan@kochen.nl"
}
+ , {
+ "name": "Patrick Georgi"
+ , "url": "https://github.com/pgeorgi"
+ }
]
, "repository" :
{ "type" : "git"

0 comments on commit 51e8eb4

Please sign in to comment.