function ProgressBar(fmt, options) {
  this.stream = options.stream || process.stderr;

  if (typeof(options) == 'number') {
    var total = options;
    options = {};
    options.total = total;
  } else {
    options = options || {};
    if ('string' != typeof fmt) throw new Error('format required');
    if ('number' != typeof options.total) throw new Error('total required');
  }

  this.fmt = fmt;
  this.curr = options.curr || 0;
  this.total = options.total;
  this.width = options.width || this.total;
  this.clear = options.clear
  this.chars = {
    complete   : options.complete || '=',
    incomplete : options.incomplete || '-',
    head       : options.head || (options.complete || '=')
  };
  this.renderThrottle = options.renderThrottle !== 0 ? (options.renderThrottle || 16) : 0;
  this.lastRender = -Infinity;
  this.callback = options.callback || function () {};
  this.tokens = {};
  this.lastDraw = '';
}
Initialize a `ProgressBar` with the given `fmt` string and `options` or
`total`.

Options:

  - `curr` current completed index
  - `total` total number of ticks to complete
  - `width` the displayed width of the progress bar defaulting to total
  - `stream` the output stream defaulting to stderr
  - `head` head character defaulting to complete character
  - `complete` completion character defaulting to "="
  - `incomplete` incomplete character defaulting to "-"
  - `renderThrottle` minimum time between updates in milliseconds defaulting to 16
  - `callback` optional function to call when the progress bar completes
  - `clear` will clear the progress bar upon termination

Tokens:

  - `:bar` the progress bar itself
  - `:current` current tick number
  - `:total` total ticks
  - `:elapsed` time elapsed in seconds
  - `:percent` completion percentage
  - `:eta` eta in seconds
  - `:rate` rate of ticks per second

@param {string} fmt
@param {object|number} options or total
@api public