multi-duplex-stream
Duplex stream that reads/writes from/to multiple duplex streams at once
Last updated 5 years ago by emilbayes .
MIT · Original npm · Tarball · package.json
$ cnpm install multi-duplex-stream 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.1.1                                ...           latest (5 years ago)

3 Versions

  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |