https://github.com/gobwas/stream-branch
Node stream branch tool
https://github.com/gobwas/stream-branch
Last synced: about 1 month ago
JSON representation
Node stream branch tool
- Host: GitHub
- URL: https://github.com/gobwas/stream-branch
- Owner: gobwas
- Created: 2015-06-05T09:36:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-13T11:14:22.000Z (over 9 years ago)
- Last Synced: 2025-02-26T23:17:23.563Z (2 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# [![NPM version][npm-image]][npm-url]
> Node Stream multiplexing tool
## Whatsup
This is a simple stream wrapper, that allows you to do the same things as [multistream](https://github.com/feross/multistream) and others, but with ability to write in combined stream:
```
source
|
transform
|
/ \
/ \
/ \
transfrom1 ... transformN
\ /
\ /
\ /
|
transform
|
result
```## Example
```js
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
```js
branch([
fs.CreateReadableStream("a.txt"),
fs.CreateReadableStream("b.txt"),
])
.pipe(someTask);
```## Install
```sh
$ npm install --save stream-branch
```## API
### streamBranch([options: Object, ]param: List[Stream]) : stream.Duplex
## License
MIT © [Sergey Kamardin](https://github.com/gobwas)
[npm-image]: https://badge.fury.io/js/stream-branch.svg
[npm-url]: https://npmjs.org/package/stream-branch
[travis-image]: https://travis-ci.org/gobwas/stream-branch.svg?branch=master
[travis-url]: https://travis-ci.org/gobwas/stream-branch
[daviddm-image]: https://david-dm.org/gobwas/stream-branch.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/gobwas/stream-branch