Skip to content

Commit

Permalink
[fix] _bytesDispatched sometimes is bigger than packages for small pa…
Browse files Browse the repository at this point in the history
…ckages.. that crashes the progressBar
  • Loading branch information
yawnt authored and AvianFlu committed Oct 25, 2012
1 parent 3f9cea0 commit 26b7a71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/jitsu/package.js
Expand Up @@ -428,7 +428,9 @@ package.updateTarball = function (version, pkg, existing, firstSnapshot, callbac
});

if(emitter) {
var size;
emitter.on('start', function(stats) {
size = stats.size;
bar = new ProgressBar('info'.green + '\t Uploading: [:bar] :percent',{
complete : '=',
incomplete: ' ',
Expand All @@ -438,7 +440,7 @@ package.updateTarball = function (version, pkg, existing, firstSnapshot, callbac
});

emitter.on('data', function(length) {
if(bar) bar.tick(length);
if(bar) bar.tick(length > size ? size : length);
});

emitter.on('end', function() {
Expand Down

0 comments on commit 26b7a71

Please sign in to comment.