pull-splitter
Split a stream into other streams using filters
const pull drain = const read write = const splitter = const extname = const split channels rest = // Pull files into splitter: // Pull results out // Pull results with no match
The splitter returns [split, channels, rest]
, where split
is a sink that pushes onto one of the channels
, or rest
if none match
See pull-merge
and pull-sorted-merge
for joining the streams back together
Install
npm install --save pull-splitter
yarn add pull-splitter
Usage
splitter(config)
Returns a sink and sources (channels
and rest
), based on the config provided
var split channels rest =
Each field in config turns into a source stream on channels
based on the filter
Then to stream data in, you use split.sink
:
Pull unmatching items through rest
:
pull(rest, drain(console.log))
Also see
pull-merge
to merge the streamspull-sorted-merge
to merge the streams with sortingpull-pair
for a basic way to link streamspull-tee
for a different mechanism of splitting a stream
Maintained by Jamen Marz (See on Twitter and GitHub for questions & updates)