Segmenter for NodeJS
To segment a set of chunks from strings or streams
Contributors
Installation
With npm do:
$ npm install segmenter
Examples
With string
var Segmenter = seg = delimiter: "." ; seg;
Output:
[ 'a', 'b', 'c' ]
With buffer
var seg = readStream = res = ; readStream; readStream;
Output:
[ 'Line 1', 'Line 2', 'etc.', ... ]
Tests
Use mocha to run the tests.
$ npm install mocha
$ mocha test
API Documentation
new Segmenter(Object options) : Object
Create the object.
Options are :
- delimiter - String : Char or String that separe the segments. Default : \n
fetch(String chunk) : Array
Fetch segments in a String.
fetch(Buffer chunk, [String encoding]) : Array
Fetch segments in a Buffer.
Also
- https://npmjs.org/package/line-reader
- https://npmjs.org/package/carrier
- https://npmjs.org/package/byline
- https://npmjs.org/package/each_line