Socket
Socket
Sign inDemoInstall

progress

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

progress - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

6

History.md
0.0.5 / 2012-08-07
==================
* add ability to tick by zero chunks - tick(0)
* fix ETA. Closes #4 [lwille]
0.0.4 / 2011-11-14

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

8

lib/node-progress.js

@@ -1,2 +0,1 @@

/*!

@@ -18,3 +17,3 @@ * node-progress

exports.version = '0.0.4';
exports.version = '0.0.5';

@@ -71,3 +70,4 @@ /**

ProgressBar.prototype.tick = function(len, tokens){
len = len || 1;
if (len !== 0)
len = len || 1;

@@ -91,3 +91,3 @@ // swap tokens

, elapsed = new Date - this.start
, eta = elapsed * (1 - (this.curr / this.total));
, eta = elapsed * (this.total / this.curr - 1)

@@ -94,0 +94,0 @@ complete = Array(complete).join(this.chars.complete);

{
"name": "progress"
, "version": "0.0.4"
, "version": "0.0.5"
, "description": "Flexible ascii progress bar"

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

@@ -1,2 +0,1 @@

# node-progress

@@ -6,2 +5,6 @@

## Installation
npm install progress
## Usage

@@ -13,13 +16,15 @@

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);
```javascript
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);
```
## Options:

@@ -47,38 +52,42 @@

var ProgressBar = require('../')
, https = require('https');
```javascript
var ProgressBar = require('../')
, https = require('https');
var req = https.request({
host: 'download.github.com'
, port: 443
, path: '/visionmedia-node-jscoverage-0d4608a.zip'
});
var req = https.request({
host: 'download.github.com'
, port: 443
, path: '/visionmedia-node-jscoverage-0d4608a.zip'
});
req.on('response', function(res){
var len = parseInt(res.headers['content-length'], 10);
req.on('response', function(res){
var len = parseInt(res.headers['content-length'], 10);
console.log();
var bar = new ProgressBar(' downloading [:bar] :percent :etas', {
complete: '='
, incomplete: ' '
, width: 20
, total: len
});
console.log();
var bar = new ProgressBar(' downloading [:bar] :percent :etas', {
complete: '='
, incomplete: ' '
, width: 20
, total: len
});
res.on('data', function(chunk){
bar.tick(chunk.length);
});
res.on('data', function(chunk){
bar.tick(chunk.length);
});
res.on('end', function(){
console.log('\n');
});
});
res.on('end', function(){
console.log('\n');
});
});
req.end();
req.end();
```
The code above will generate a progress bar that looks like this:
downloading [===== ] 29% 3.7s
```
downloading [===== ] 29% 3.7s
```
## License

@@ -88,3 +97,3 @@

Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2011 TJ Holowaychuk `<tj@vision-media.ca>`

@@ -91,0 +100,0 @@ Permission is hereby granted, free of charge, to any person obtaining

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