Socket
Socket
Sign inDemoInstall

progress

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.5 to 0.1.0

7

History.md
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 @@ ==================

21

lib/node-progress.js

@@ -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"]

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc