streamss-fork
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i streamss-fork

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

12.9 kB

Total Files

6

Last publish

Collaborators

  • commenthol