Skip to content

Duplex stream that reads/writes from/to multiple duplex streams at once

License

Notifications You must be signed in to change notification settings

emilbayes/multi-duplex-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}

Documentation

multiDuplex([[streams], options]) / new MultiDuplex([[streams], options])

multiDuplex.obj([[streams], options])

.add(stream)

.remove(stream)

.streams

.destroy([err])

.destroyed

.finalize()

License

MIT

About

Duplex stream that reads/writes from/to multiple duplex streams at once

Resources

License

Stars

Watchers

Forks

Packages

No packages published