Chunk/split your stream without eating the splitter char.
node v0.10.x required.
Split your streams into chunks with an arbitary-length matcher. Explicitly does not consume tokens. Useful for splitting up chunks and passing it to an external parser that expects the split tokens to be there.
This module exports a
Chunker class. This is simply an instance of a
Transform stream so you can pipe things in and it will only output
readable) a chunk that has all the content from the start of the first
chunk until the specified splitter token (called a
matcher inside the
var fs = require'fs' Chunker = require'./index.js';var chunker = matcher: 'what 'input = fscreateReadStream'./input.txt';chunkeron'readable'var chunk;while chunk = chunkerreadconsole.logchunktoString;;processstdinpipechunker;
$ node example.jsdo whatyou want to do not whatyou are told to do and do whatmakes you happy and keep away from whatmakes you sad but do whatyou have to do that is whatresposibility means but do not forget whatmakes your heart tick or you will forgot what
BSD3 (see LICENSE file)