0.1.4 • Published 8 years ago

stream-branch v0.1.4

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

NPM version

Node Stream multiplexing tool

Whatsup

This is a simple stream wrapper, that allows you to do the same things as multistream and others, but with ability to write in combined stream:

         source
            |   
        transform
            |
           / \
          /   \
         /     \
transfrom1 ... transformN
         \     /
          \   /
           \ /
            |
        transform
            |
          result

Example

var branch = require("stream-branch");

// for example, browserify.bundle()
getSomeReadableStream()
	.pipe(makeCommonThings())
	.pipe(branch({ objectMode: true },
	    [
	    	// here list of transform streams
	        makeSomeTask(),
	        makeAnotherTask()
	    ]
	))
	.pipe(gulp.dest("./dist"))
	.pipe(uglify())
	.pipe(rename({ extname: ".min.js" }))
	.pipe(gulp.dest("./dist"));

Or

branch([
	fs.CreateReadableStream("a.txt"),
	fs.CreateReadableStream("b.txt"),
])
.pipe(someTask);

Install

$ npm install --save stream-branch

API

streamBranch(options: Object, param: ListStream) : stream.Duplex

License

MIT © Sergey Kamardin