code: function collectAll (callback, options) {
    var collectTransform = new CollectTransform(options)
    if (callback && typeof callback === 'function') {
      return connect(collectTransform, through(callback, options))
    } else {
      return collectTransform
    }
  }
docs: @param [callback] {function} - Called once with the collected input data (by default a `Buffer` instance, or array in `objectMode`.). The value returned by this callback function will be passed downstream.
  @param [options] {object} - [Stream options](https://nodejs.org/dist/latest-v5.x/docs/api/stream.html#stream_new_stream_readable_options) object, passed to the constructor for the stream returned by `collect-all`. If the callback function supplied returns a non-string/buffer value, set `options.objectMode` to `true`.
  @return {external:Duplex}
  @alias module:collect-all
  @example
  An example command-line client script - string input received at stdin is stamped with `received` then written to  stdout.
  ```js
  var collectAll = require('collect-all')
  process.stdin
  .pipe(collectAll(function (input) {
  input = 'received: ' + input
  return input
  }))
  .pipe(process.stdout)
  ```
  
  An object-mode example:
  ```js
  var collectAll = require('collect-all')
  
  function onAllCollected (collected) {
  console.log('Objects collected: ' + collected.length)
  }
  
  var stream = collectAll(onAllCollected, { objectMode: true })
  stream.write({})
  stream.write({})
  stream.end({}) // outputs 'Objects collected: 3'
  ```