Fork stream2 into several streams
Fork a single stream into multiple other streams. The main stream can be piped as well.
npm i -S streamss-fork
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)
Parameters:
{Writable[]} streams
- Array of Writable Streams{Object} [options]
- see https://nodejs.org/...
Return:
{Transform}
A Transform stream
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.
Copyright (c) 2019 commenthol (MIT License)
See LICENSE for more info.