index.js
function pause (stream) {
  var events = []
  var onData = createEventListener('data', events)
  var onEnd = createEventListener('end', events)

  // buffer data
  stream.on('data', onData)

  // buffer end
  stream.on('end', onEnd)

  return {
    end: function end () {
      stream.removeListener('data', onData)
      stream.removeListener('end', onEnd)
    },
    resume: function resume () {
      this.end()

      for (var i = 0; i < events.length; i++) {
        stream.emit.apply(stream, events[i])
      }
    }
  }
}
function pause (stream) {
  var events = []
  var onData = createEventListener('data', events)
  var onEnd = createEventListener('end', events)

  // buffer data
  stream.on('data', onData)

  // buffer end
  stream.on('end', onEnd)

  return {
    end: function end () {
      stream.removeListener('data', onData)
      stream.removeListener('end', onEnd)
    },
    resume: function resume () {
      this.end()

      for (var i = 0; i < events.length; i++) {
        stream.emit.apply(stream, events[i])
      }
    }
  }
}
function pause ( stream ) { var events = [ ] var onData = createEventListener ( 'data' , events ) var onEnd = createEventListener ( 'end' , events ) // buffer data stream . on ( 'data' , onData ) // buffer end stream . on ( 'end' , onEnd ) return { end : function end ( ) { stream . removeListener ( 'data' , onData ) stream . removeListener ( 'end' , onEnd ) } , resume : function resume ( ) { this . end ( ) for ( var i = 0 ; i < events . length ; i ++ ) { stream . emit . apply ( stream , events [ i ] ) } } } }
Pause the data events on a stream.

@param {object} stream
@public
Pause the data events on a stream .