code: function streamConsole(name, buildNumber, interval, cb) {
  
    buildNumber = buildNumber || 'lastBuild';
  
    var stream = new ConsoleStream();
    var self   = this;
  
    function _processMoreChunks(result, response, cb) {
      if (response.text) {
        stream.emit('data', response.text);
      }
      // stream while there are more data
      async.whilst(
        function () {
          return response.headers['x-more-data'] === 'true';
        },
        function (cb) {
          function _moreChunkCb(err, _result, _response) {
            response = _response;
            if (_response.text) {
              stream.emit('data', _response.text);
            }
            setTimeout(cb, interval);
          }
          var start = parseInt(response.headers['x-text-size'], 10);
          self.remoteAccessApi.getJobProgressiveText(name, buildNumber, start, _moreChunkCb);
        },
        function (err) {
          stream.emit('end');
          cb(err);
        }
      );
    }
  
    process.nextTick(function () {
      // start with value 0 indicates the first chunk of the console output
      var start = 0;
      function _firstChunkCb(err, result, response) {
        if (!err && response.statusCode === 200) {
          _processMoreChunks(result, response, cb);
        } else {
          cb(err, result);
        }
      }
      self.remoteAccessApi.getJobProgressiveText(name, buildNumber, start, _firstChunkCb);
    });
  
    return stream;
  }
docs: Stream a Jenkins job console output (readable stream).
  Jenkins uses the following headers:
  - x-more-data to determine whether there are still more content coming through
  - x-text-size to determine the starting point of progressive text output (this was obviously badly named, but stayed there for backward compatibility reason)
  
  @param {String} name: Jenkins job name
  @param {Number} buildNumber: Jenkins job's build number
  @param {Number} interval: interval between console requests in milliseconds
  @param {Function} cb: standard cb(err, result) callback
  @return {ConsoleStream} readable console output stream