progress
Advanced tools
Comparing version 0.0.5 to 0.1.0
0.1.0 / 2012-09-19 | ||
================== | ||
* Fixed logic bug that caused bar to jump one extra space at the end [davglass] | ||
* Working with readline impl, even on Windows [davglass] | ||
* Using readline instead of the \r hack [davglass] | ||
0.0.5 / 2012-08-07 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -17,3 +17,3 @@ /*! | ||
exports.version = '0.0.5'; | ||
exports.version = '0.1.0'; | ||
@@ -46,6 +46,11 @@ /** | ||
function ProgressBar(fmt, options) { | ||
this.rl = require('readline').createInterface({ | ||
input: process.stdin, | ||
output: options.stream || process.stdout | ||
}); | ||
this.rl.setPrompt('', 0); | ||
options = options || {}; | ||
if ('string' != typeof fmt) throw new Error('format required'); | ||
if ('number' != typeof options.total) throw new Error('total required'); | ||
this.stream = options.stream || process.stdout; | ||
this.fmt = fmt; | ||
@@ -83,3 +88,5 @@ this.curr = 0; | ||
this.complete = true; | ||
this.stream.write('\r\033[2K'); | ||
//this.rl.write(null, {ctrl: true, name: 'u'}); | ||
this.rl.resume(); | ||
this.rl.close(); | ||
return; | ||
@@ -90,8 +97,7 @@ } | ||
, complete = Math.round(this.width * (this.curr / this.total)) | ||
, incomplete = this.width - complete | ||
, incomplete | ||
, elapsed = new Date - this.start | ||
, eta = elapsed * (this.total / this.curr - 1) | ||
complete = Array(complete).join(this.chars.complete); | ||
incomplete = Array(incomplete).join(this.chars.incomplete); | ||
incomplete = Array(this.width - complete.length).join(this.chars.incomplete); | ||
@@ -112,3 +118,4 @@ var str = this.fmt | ||
this.stream.write('\r\033[2K' + str); | ||
this.rl.write(null, {ctrl: true, name: 'u'}); | ||
this.rl.write(str); | ||
}; |
{ | ||
"name": "progress" | ||
, "version": "0.0.5" | ||
, "version": "0.1.0" | ||
, "description": "Flexible ascii progress bar" | ||
@@ -5,0 +5,0 @@ , "keywords": ["cli", "progress"] |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
6997
100
0