lib/readarray.js
function ReadArray (options, array) {
  if (!(this instanceof ReadArray)) {
    return new ReadArray(options, array)
  }

  if (Array.isArray(options)) {
    array = options
    options = {}
  }

  options = Object.assign({}, options)
  Readable.call(this, options)

  this._array = array || []
  this._cnt = this._array.length

  return this
}
function ReadArray (options, array) {
  if (!(this instanceof ReadArray)) {
    return new ReadArray(options, array)
  }

  if (Array.isArray(options)) {
    array = options
    options = {}
  }

  options = Object.assign({}, options)
  Readable.call(this, options)

  this._array = array || []
  this._cnt = this._array.length

  return this
}
function ReadArray ( options , array ) { if ( ! ( this instanceof ReadArray ) ) { return new ReadArray ( options , array ) } if ( Array . isArray ( options ) ) { array = options options = { } } options = Object . assign ( { } , options ) Readable . call ( this , options ) this . _array = array || [ ] this . _cnt = this . _array . length return this }
Read from an Array and push into stream.

Takes care on pausing to push to the stream if pipe is saturated.

@constructor
@param {Object} [options] - Stream Options `{encoding, highWaterMark, objectMode, ...}`
@param {Array} array - array to push down as stream (If array is an array of objects set `objectMode:true` or use `ReadArray.obj`)
@return {Readable} A readable stream
Read from an Array and push into stream .