Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Evented stream line reader for node.js
JavaScript
tree: c655e82e7b

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
tools
LICENSE
Makefile
README.markdown
package.json

README.markdown

Carrier helps you implement new-line terminated protocols over node.js.

The client can send you chunks of lines and carrier will only notify you on each completed line.

Install

$ npm install carrier

Usage

var net     = require('net'),
    carrier = require('carrier');

var server = net.createServer(function(conn) {
  carrier.carry(conn, function(line) {
    console.log('got one line: ' + line);
  });
});
server.listen(4001);

Or, you can also listen to the "line" event on the returned object of carrier.carry() like this:

var net     = require('net'),
    carrier = require('carrier');

var server = net.createServer(function(conn) {
  var my_carrier = carrier.carry(conn);
  my_carrier.on('line',  function(line) {
    console.log('got one line: ' + line);
  });
});
server.listen(4001);
Something went wrong with that request. Please try again.