linerstream
Split a readable stream by newline characters
Last updated 11 years ago by nisaacson .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install linerstream 
SYNC missed versions from official npm registry.

linerstream

Split a readable stream by newline characters

NPM

Build Status Dependency Status Code Climate

Installation

npm install -S linerstream

Usage

Create an instance of linestream and pipe a readable stream into that instance

var Linerstream = require('linerstream')
// splitter is an instance of require('stream').Transform
var opts = {
  highWaterMark: 2
}
var splitter = new Linerstream(opts) // opts is optional

var readStream = fs.createReadStream('/file/with/line/breaks.txt')
var lineByLineStream = readStream.pipe(splitter)
lineByLineStream.on('data', function(chunk) {
  console.dir(chunk)  // no line breaks here :)
})

Override EOL

If you don't want to use the OS default EOL character, you can ovverride it when creating the stream

var stream2 = new LinerStream({EOL: '\n'})
//force windows EOL
var stream3 = new LinerStream({EOL: '\r\n'})

Current Tags

  • 0.2.0                                ...           latest (8 years ago)

12 Versions

  • 0.2.0                                ...           8 years ago
  • 0.1.4                                ...           10 years ago
  • 0.1.3                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
  • 0.0.6                                ...           11 years ago
  • 0.0.5                                ...           11 years ago
  • 0.0.4                                ...           11 years ago
  • 0.0.3                                ...           11 years ago
  • 0.0.2                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Downloads
Today 0
This Week 0
This Month 5
Last Day 0
Last Week 5
Last Month 0
Dependencies (2)
Dev Dependencies (3)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |