Package Exports
- stream-connect
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stream-connect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
Param | Type | Description |
---|---|---|
one | Duplex |
source stream |
two | Duplex |
dest stream, to be connected to |
© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.