package
streaming pipeline with a mutable configuration
npm install stream-splicerGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
streaming pipeline with a mutable configuration
This module is similar to stream-combiner, but with a pipeline configuration that can be changed at runtime.
This example begins with an HTTP header parser that waits for an empty line to signify the end of the header. At that point, it switches to a streaming json parser to operate on the HTTP body.
var splicer = require('stream-splicer');
var through = require('through2');
var jsonStream = require('jsonstream2');
var split = require('split2');
var headerData = {};
var headers = through.obj(function (buf, enc, next) {
var line = buf.toString('utf8');
if (line === '') {
this.push(headerData);
pipeline.splice(
intput:
GET / HTTP/1.1
Host: substack.net
User-Agent: echo
{"rows":["beep","boop"]}output:
$ echo -ne 'GET / HTTP/1.1\nHost: substack.net\nUser-Agent: echo\n\n{"rows":["beep","boop"]}\n' | node example/header.js
[
{"Host":"substack.net","User-Agent":"echo"}
,
"beep"
,
"boop"
]var splicer = require('stream-splicer')Create a pipeline duplex stream given an array of streams. Each stream
will be piped to the next. Writes to pipeline get written to the first stream
and data for reads from pipeline come from the last stream.
For example, for streams [ a, b, c, d ], this pipeline is constructed
internally:
a.pipe(b).pipe(c).pipe(d)Input will get written into a. Output will be read from d.
If any of the elements in streams are arrays, they will be converted into
nested pipelines. This is useful if you want to expose a hookable pipeline with
grouped insertion points.
Create a pipeline with opts.objectMode set to true for convenience.
Splice the pipeline starting at index, removing howMany streams and
replacing them with each additional stream argument provided.
The streams that were removed from the splice and returned.
Push one or more streams to the end of the pipeline.
Pop a stream from the end of the pipeline.
Unshift one or more streams to the begining of the pipeline.
Shift a stream from the begining of the pipeline.
Return the stream at index index, .... Indexes can be negative.
Multiple indexes will traverse into nested pipelines.
The number of streams in the pipeline
With npm do:
npm install stream-splicerMIT
gkatsev
me@gkatsev.com
maxogden
max@maxogden.com
thlorenz
thlorenz10@gmail.com
terinjokes
terinjokes@gmail.com
jmm
npm-public@jessemccarthy.net
mellowmelon
palmermebane@gmail.com
ashaffer88
darawk@gmail.com
balupton
b@lupton.cc
cwmma
calvin.metcalf@gmail.com
jprichardson
jprichardson@gmail.com
indutny
blackhole@livebox.sh
jryans
jryans@gmail.com
sethvincent
sethvincent@gmail.com
yoshuawuyts
javascript@yosh.is
ungoldman
ungoldman@gmail.com
ahdinosaur
michael.williams@enspiral.com
elnounch
contact@elnounch.net
parshap
parshap+npm@gmail.com
yerkopalma
yerko.palma@usach.cl
forbeslindesay
forbes@lindesay.co.uk
leichtgewicht
martin.heidegger@gmail.com
garann
garann@gmail.com
bret
bcomnes@gmail.com
anandthakker
vestibule@anandthakker.net
mattdesl
dave.des@gmail.com
hughsk
hughskennedy@gmail.com
fpereira1
pereira.filype@gmail.com
goto-bus-stop
renee@kooi.me
bpostlethwaite
post.ben.here@gmail.com
emilbayes
github@tixz.dk
stevemao
maochenyan@gmail.com
pkrumins
peteris.krumins@gmail.com
tehshrike
me@JoshDuff.com
defunctzombie
shtylman@gmail.com
lukechilds
lukechilds123@gmail.com
raynos
raynos2@gmail.com
Estimated unpacked size across 12 packages.
930.2 kB
Includes dependencies.