lib/util/resource_stream.js
function ResourceStream(collection) {
  var me = this;
  BufferedReadable.call(me, {
    objectMode: true
  });

  // @type {Collection} The collection whose data was last pushed into the
  //     stream, such that if we have to go back for more, we should fetch
  //     its `nextPage`.
  me._collection = collection;

  // @type {boolean} True iff a request for more items is in flight.
  me._fetching = false;

  // Ensure the initial collection's data is in the stream.
  me._pushCollection();
}
function ResourceStream(collection) {
  var me = this;
  BufferedReadable.call(me, {
    objectMode: true
  });

  // @type {Collection} The collection whose data was last pushed into the
  //     stream, such that if we have to go back for more, we should fetch
  //     its `nextPage`.
  me._collection = collection;

  // @type {boolean} True iff a request for more items is in flight.
  me._fetching = false;

  // Ensure the initial collection's data is in the stream.
  me._pushCollection();
}
function ResourceStream ( collection ) { var me = this ; BufferedReadable . call ( me , { objectMode : true } ) ; // @type {Collection} The collection whose data was last pushed into the //     stream, such that if we have to go back for more, we should fetch //     its `nextPage`. me . _collection = collection ; // @type {boolean} True iff a request for more items is in flight. me . _fetching = false ; // Ensure the initial collection's data is in the stream. me . _pushCollection ( ) ; }
A ResourceStream is a Node stream implementation for objects that are
fetched from the API. Basically, any Collection of resources from the
API can be wrapped in this stream, and the stream will fetch new pages
of items as needed.

@param {Collection} collection Response from initial collection request.
@constructor
A ResourceStream is a Node stream implementation for objects that are fetched from the API . Basically any Collection of resources from the API can be wrapped in this stream and the stream will fetch new pages of items as needed .