Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tiny utility to process streams line per line
JavaScript
tree: 2d8756da25

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
lines.js
package.json

README.md

This module is long deprecated. Please do not use it anymore (was for node 0.1). I suggest you use split

this is a tiny utility function to help processing readable streams line per line with NodeJS

Here is a simple example which explains almost everything

var lines = require('lines');
var net = require('net');

net.createServer(function(socket) {
    socket.setEncoding('utf8');
    lines(socket); // here is where the magic happens
    socket.on('line', function(line) {
      // line is one line with no trailing \n or \r
    });
}).listen('/tmp/mysock');

Lines doesn't work on non-encoded streams. Note that you can still listen to 'data' events on the same stream with no loss of data.

install it via npm

npm install lines

or get the code from the repository

Something went wrong with that request. Please try again.