Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

azuki-trusty / azk   deb

Repository URL to install this package:

Version: 0.5.1 

/ usr / lib / azk / node_modules / progress / examples / download.js


/**
 * Module dependencies.
 */

var ProgressBar = require('../');

// simulated download, passing the chunk lengths to tick()

var contentLength = 128 * 1024;

var bar = new ProgressBar('  downloading [:bar] :percent :etas', {
    complete: '='
  , incomplete: ' '
  , width: 20
  , total: contentLength
});

(function next() {
  if (contentLength) {
    var chunk = Math.random() * 10 * 1024;
    bar.tick(chunk);

    if (!bar.complete) {
      setTimeout(next, Math.random() * 1000);
    }
  }
})();