chrisdew chrisdew - 1 year ago 87
Node.js Question

NodeJS streams - a leaky pipe?

I'm doing a lot of work with NodeJS streams at the moment.

One thing I find myself needing is a 'leaky pipe'.


, but which just drops data if (and only if) it has no where to send it.

Does such a thing already exist?

Is there a way of finding out (within a
) how many downstream pipes are connected?

Answer Source

I eventually came up with a solution:

LeakyTransform.prototype._transform = function(chunk, encoding, done) {
  if (this._readableState.pipesCount > 0) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download