1.0.1 • Published 4 years ago

streamss-fork v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

streamss-fork

Fork stream2 into several streams

NPM version Build Status

Fork a single stream into multiple other streams. The main stream can be piped as well.

Install

npm i -S streamss-fork

Example

Fork a stream

Same as cat package.json | tee one.log two.log in bash...

const fs = require('fs')
const { fork } = require('streamss-fork')

const one = fs.createWriteStream(`./one.log`)
const two = fs.createWriteStream(`./two.log`)

fs.createReadStream(`./package.json`)
  .pipe(fork([one, two]/* ,{ objectMode: false }*/))
  .pipe(process.stdout)

Methods

fork(streams, options)

Parameters:

Return:

{Transform} A Transform stream

Contribution and License Agreement

If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work or correctly attributed with the source of its origin and licence.

License

Copyright (c) 2019 commenthol (MIT License)

See LICENSE for more info.

1.0.1

4 years ago

1.0.0

6 years ago