Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-connect

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-connect

Create a pipeline of connected streams

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
137K
decreased by-8.45%
Maintainers
1
Weekly downloads
 
Created
Source

view on npm npm module downloads per month Build Status Dependency Status js-standard-style

stream-connect

Connect two streams returning a single duplex stream. Use over .pipe() when you want to write to the source stream yet read from the destination.

Example

const connect = require('stream-connect')

function streamsOneAndTwo () {
  const streamOne = getStreamOneSomehow()
  const streamTwo = getStreamTwoSomehow()

  // We want to return streams one and two pre-connected. We can't return
  // `streamOne.pipe(streamTwo)` as this returns streamTwo while the calling code
  // wants to write to streamOne yet receive the output from streamTwo.
  // So, return a new stream which is streams one and two connected:
  const streamsOneAndTwo = connect(streamOne(), streamTwo())
}

// main.js is piped through the pre-connected streamOne and streamTwo, then stdout
fs.createReadStream('main.js')
  .pipe(streamsOneAndTwo())
  .pipe(process.stdout)

connect(one, two) ⇒ Duplex

Connects two streams together.

Kind: Exported function

ParamTypeDescription
oneDuplexsource stream
twoDuplexdest stream, to be connected to

© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.

Keywords

FAQs

Package last updated on 26 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc