Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cli-progress

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-progress - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

4

CHANGES.md

@@ -0,1 +1,5 @@

### 1.5.1 ###
* Bugifx: Progressbar cannot be initialized to 0% - thanks to [erikkallen on GitHub](https://github.com/AndiDittrich/Node.CLI-Progress/pull/14) #13
* Bugfix: ETA was **NULL** in case the progress bar is initialized with (0/0)
### 1.5.0 ###

@@ -2,0 +6,0 @@ * Added: **0** values for total/progress initialization are allowed - feature requested by [jfmmm on GitHub](https://github.com/AndiDittrich/Node.CLI-Progress/issues/11) #11

@@ -7,3 +7,5 @@ var _progress = require('./main');

Example3(function(){
console.log('\nDemo finished!');
Example4(function(){
console.log('\nDemo finished!');
});
});

@@ -108,2 +110,17 @@ });

}, 20);
}
}
function Example4(onComplete){
// EXAMPLE 1 ---------------------------------------------
console.log('\nExample 4 - Start ZERO');
// create new progress bar using default values
var b1 = new _progress.Bar();
b1.start(0, 0);
setTimeout(function(){
b1.stop();
// run complete callback
onComplete.apply(this);
}, 1000);
}

22

lib/Bar.js

@@ -74,5 +74,9 @@ var _readline = require('readline');

// calculate the normalized current progress
// handle NaN Errors
var progress = (this.value/this.total) || 1.0;
var progress = (this.value/this.total);
// handle NaN Errors caused by total=0. Set to complete in this case
if (isNaN(progress)){
progress = 1.0;
}
// limiter

@@ -112,3 +116,3 @@ progress = Math.min(Math.max(progress, 0.0), 1.0);

// set cursor to start of line
_readline.cursorTo(this.stream, 0);
_readline.cursorTo(this.stream, 0, null);

@@ -174,5 +178,2 @@ // write output

// redraw on start!
this.render();
// initialize eta buffer

@@ -182,4 +183,7 @@ this.eta = {

timeBuffer: [this.startTime],
time: null
time: 0
};
// redraw on start!
this.render();
};

@@ -200,3 +204,3 @@

if (this.clearOnComplete && this.stream.isTTY){
_readline.cursorTo(this.stream, 0);
_readline.cursorTo(this.stream, 0, null);
_readline.clearLine(this.stream, 0);

@@ -274,3 +278,3 @@ }else{

// eq: vt_rate *x = total
var eta = remaining/vt_rate/1000;
var eta = (remaining/vt_rate/1000);

@@ -277,0 +281,0 @@ this.eta = {

{
"name": "cli-progress",
"version": "1.5.0",
"version": "1.5.1",
"description": "Easy to use Progress-Bar for Command-Line/Terminal Applications",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc