multi-duplex-stream
v0.1.1
Published
Duplex stream that reads/writes from/to multiple duplex streams at once
Downloads
80
Maintainers
Readme
multi-duplex-stream
Duplex stream that reads/writes from/to multiple duplex streams at once
Installation
npm install multi-duplex-stream
Example
Below is a minimal example of running ssh commands in parallel:
'use strict'
var ssh = require('ssh-exec')
var eos = require('end-of-stream')
var multiDuplex = require('multi-duplex-stream')
module.exports = function pssh (hosts, cmd, cb) {
var sshStreams = hosts.map(function (host) {
var stream = ssh(cmd, host)
return stream
})
var psshStream = multiDuplex.obj(sshStreams)
eos(psshStream, cb)
return psshStream
}