index.js
function resumeable(last,source,s){
  source.last = last;
  source.on('data',function(data){
    source.last = data;
    s.write(data);
  })

  var onPause = function(){
    source.pause();
  };

  var onDrain = function(){
    source.resume();
  };

  var onEnd = function(){
    source.end();
  };

  var cleanup = function(){
    s.removeListener('pause',onPause);
    s.removeListener('drain',onDrain);
    s.removeListener('end',onEnd);
  };

  s.on('pause',onPause);
  s.on('drain',onDrain);
  s.on('end',onEnd);

  source.on('error',function(){
    source._errored = true;
    cleanup();
  });
  source.on('end',function(){
    cleanup();
    if(!source._errored) {
      s.end();
    }
  })
  return s;
}
function resumeable(last,source,s){
  source.last = last;
  source.on('data',function(data){
    source.last = data;
    s.write(data);
  })

  var onPause = function(){
    source.pause();
  };

  var onDrain = function(){
    source.resume();
  };

  var onEnd = function(){
    source.end();
  };

  var cleanup = function(){
    s.removeListener('pause',onPause);
    s.removeListener('drain',onDrain);
    s.removeListener('end',onEnd);
  };

  s.on('pause',onPause);
  s.on('drain',onDrain);
  s.on('end',onEnd);

  source.on('error',function(){
    source._errored = true;
    cleanup();
  });
  source.on('end',function(){
    cleanup();
    if(!source._errored) {
      s.end();
    }
  })
  return s;
}
function resumeable ( last , source , s ) { source . last = last ; source . on ( 'data' , function ( data ) { source . last = data ; s . write ( data ) ; } ) var onPause = function ( ) { source . pause ( ) ; } ; var onDrain = function ( ) { source . resume ( ) ; } ; var onEnd = function ( ) { source . end ( ) ; } ; var cleanup = function ( ) { s . removeListener ( 'pause' , onPause ) ; s . removeListener ( 'drain' , onDrain ) ; s . removeListener ( 'end' , onEnd ) ; } ; s . on ( 'pause' , onPause ) ; s . on ( 'drain' , onDrain ) ; s . on ( 'end' , onEnd ) ; source . on ( 'error' , function ( ) { source . _errored = true ; cleanup ( ) ; } ) ; source . on ( 'end' , function ( ) { cleanup ( ) ; if ( ! source . _errored ) { s . end ( ) ; } } ) return s ; }
its kinda like pipe except everythig bubbles.
its kinda like pipe except everythig bubbles .