Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
disconnect all listeners for a given stream without closing
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
index.js
package.json
test.js

README.md

disconnect-stream

given a source stream, disconnect it from all of its downstream listeners (without closing the source or dest streams!)

var through = require('through')
  , disconnect = require('disconnect-stream')
  , source = through()
  , dest = through()

source.pipe(dest)

dest.on('data', function() {
  console.log('got data')
})

source.write('data') // "got data"

disconnect(source) // returns `true` since there were dest pipes

source.write('data')

source.readable && source.writable // true
dest.readable && dest.writable // true

api

disconnect(source stream) -> Boolean

non-destructively disconnect all downstream destinations of source. returns true if any destinations were disconnected, or false if there were no downstream listeners.

license

MIT

Something went wrong with that request. Please try again.