Socket
Socket
Sign inDemoInstall

progress

Package Overview
Dependencies
0
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

6

History.md
0.0.2 / 2011-04-20
==================
* Added custom tokens support
* Fixed; clear line before writing
0.0.1 / 2010-01-03

@@ -3,0 +9,0 @@ ==================

21

lib/node-progress.js

@@ -18,3 +18,3 @@

exports.version = '0.0.1';
exports.version = '0.0.2';

@@ -62,11 +62,16 @@ /**

/**
* "tick" the progress bar with optional `len`.
* "tick" the progress bar with optional `len` and
* optional `tokens`.
*
* @param {Number} len
* @param {Number|Object} len or tokens
* @param {Object} tokens
* @api public
*/
ProgressBar.prototype.tick = function(len){
ProgressBar.prototype.tick = function(len, tokens){
len = len || 1;
// swap tokens
if ('object' == typeof len) tokens = len, len = 1;
// start time for eta

@@ -98,3 +103,9 @@ if (0 == this.curr) this.start = new Date;

this.stream.write('\r' + str);
if (tokens) {
for (var key in tokens) {
str = str.replace(':' + key, tokens[key]);
}
}
this.stream.write('\r\x1b[2K' + str);
};
{
"name": "progress"
, "version": "0.0.1"
, "version": "0.0.2"
, "description": "Flexible ascii progress bar"

@@ -5,0 +5,0 @@ , "keywords": ["cli", "progress"]

@@ -12,12 +12,12 @@

var ProgressBar = require('progress');
var ProgressBar = require('progress');
var bar = new ProgressBar(':bar', { total: 10 });
var timer = setInterval(function(){
bar.tick();
if (bar.complete) {
console.log('\ncomplete\n');
clearInterval(timer);
}
}, 100);
var bar = new ProgressBar(':bar', { total: 10 });
var timer = setInterval(function(){
bar.tick();
if (bar.complete) {
console.log('\ncomplete\n');
clearInterval(timer);
}
}, 100);

@@ -38,3 +38,3 @@ ## Options:

- `:percent` completion percentage
- `:eta` eta in seconds
- `:eta` estimated completion time in seconds

@@ -45,3 +45,3 @@ ## Examples

In the download example each tick has a variable influence, so we pass the chunk length which adjusts the progress bar appropriately relative to the total length.
In our download example each tick has a variable influence, so we pass the chunk length which adjusts the progress bar appropriately relative to the total length.

@@ -79,3 +79,7 @@ var ProgressBar = require('../')

The code above will generate a progress bar that looks like this:
downloading [===== ] 29% 3.7s
## License

@@ -82,0 +86,0 @@

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