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 2.1.1 to 3.0.0

lib/eta.js

9

CHANGES.md

@@ -0,1 +1,10 @@

## Branch 3.x ##
### 3.0.0 ###
* Added: multi-progressbar support - feature requested [on GitHub](https://github.com/AndiDittrich/Node.CLI-Progress/issues/26)
* Added: option `synchronousUpdate` to control the synchronized redraw during `update()` call (default=`true`)
* Changed: project split into multiple classes
* Changed: default cli progress output is written to `stdout` instead of `stderr`
## Branch 2.x ##

@@ -2,0 +11,0 @@

7

cli-progress.js

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

const _Bar = require('./lib/Bar');
const _SingleBar = require('./lib/single-bar');
const _MultiBar = require('./lib/multi-bar');
const _Presets = require('./presets/index');

@@ -6,4 +7,6 @@

module.exports = {
Bar: _Bar,
Bar: _SingleBar,
SingleBar: _SingleBar,
MultiBar: _MultiBar,
Presets: _Presets
};
{
"name": "cli-progress",
"version": "2.1.1",
"description": "Easy to use Progress-Bar for Command-Line/Terminal Applications",
"version": "3.0.0",
"description": "easy to use progress-bar for command-line/terminal applications",
"keywords": [

@@ -6,0 +6,0 @@ "cli",

@@ -9,2 +9,5 @@ CLI-Progress

Install

@@ -14,4 +17,4 @@ --------

```bash
$ yarn add cli-progress
$ npm install cli-progress --save
$ yarn add cli-progress --save
```

@@ -24,2 +27,4 @@

* Full customizable output format (constious placeholders are available)
* Single progressbar mode
* Multi progessbar mode
* Custom Bar Characters

@@ -34,7 +39,6 @@ * FPS limiter

Usage
------------
Multiple examples are available e.g. [example.js](https://github.com/AndiDittrich/Node.CLI-Progress/blob/master/examples/example.js) - just try it `$ node example.js`
Multiple examples are available e.g. [example.js](https://github.com/AndiDittrich/Node.CLI-Progress/blob/master/examples/example.js) - just try it `$ node example.js`

@@ -45,3 +49,3 @@ ```js

// create a new progress bar instance and use shades_classic theme
const bar1 = new _cliProgress.Bar({}, _cliProgress.Presets.shades_classic);
const bar1 = new _cliProgress.SingleBar({}, _cliProgress.Presets.shades_classic);

@@ -58,5 +62,33 @@ // start the progress bar with a total value of 200 and start value of 0

Methods/Syntax
Single Bar Mode
-----------------------------------
![Demo](assets/presets.png)
### Example ###
```js
const _cliProgress = require('cli-progress');
// create new progress bar
const b1 = new _cliProgress.SingleBar({
format: 'CLI Progress |' + _colors.cyan('{bar}') + '| {percentage}% || {value}/{total} Chunks || Speed: {speed}',
barCompleteChar: '\u2588',
barIncompleteChar: '\u2591',
hideCursor: true
});
// initialize the bar - defining payload token "speed" with the default value "N/A"
b1.start(200, 0, {
speed: "N/A"
});
// update values
b1.increment();
b1.update(20);
// stop the bar
b1.stop();
```
### Constructor ###

@@ -67,3 +99,5 @@

```js
const <instance> = new namespace.Bar(options:object [, preset:object]);
const _cliProgress = require('cli-progress');
const <instance> = new _cliProgress.SingleBar(options:object [, preset:object]);
```

@@ -73,14 +107,2 @@

- `format` (type:string) - progress bar output format @see format section
- `fps` (type:float) - the maximum update rate (default: 10)
- `stream` (type:stream) - output stream to use (default: `process.stderr`)
- `stopOnComplete` (type:boolean) - automatically call `stop()` when the value reaches the total (default: false)
- `clearOnComplete` (type:boolean) - clear the progress bar on complete / `stop()` call (default: false)
- `barsize` (type:int) - the length of the progress bar in chars (default: 40)
- `align` (type:char) - position of the progress bar - 'left' (default), 'right' or 'center'
- `barCompleteString` (type:char) - character to use as "complete" indicator in the bar (default: "=")
- `barIncompleteString` (type:char) - character to use as "incomplete" indicator in the bar (default: "-")
- `hideCursor` (type:boolean) - hide the cursor during progress operation; restored on complete (default: false) - pass `null` to keep terminal settings
- `linewrap` (type:boolean) - disable line wrapping (default: false) - pass `null` to keep terminal settings; pass `true` to add linebreaks automatically (not recommended)
- `etaBuffer` (type:int) - number of updates with which to calculate the eta; higher numbers give a more stable eta (default: 10)

@@ -127,3 +149,85 @@ ### ::start() ###

Multi Bar Mode
-----------------------------------
![Demo](assets/multibar.png)
### Example ###
```js
const _cliProgress = require('./cli-progress');
// create new container
const multibar = new _cliProgress.MultiBar({
clearOnComplete: false,
hideCursor: true
}, _cliProgress.Presets.shades_grey);
// add bars
const b1 = multibar.create(200, 0);
const b2 = multibar.create(1000, 0);
// control bars
b1.increment();
b2.update(20, {filename: "helloworld.txt"});
// stop all bars
multibar.stop();
```
### Constructor ###
Initialize a new multiprogress container. Bars need to be added. The options/presets are used for each single bar!
```js
const _cliProgress = require('cli-progress');
const <instance> = new _cliProgress.MultiBar(options:object [, preset:object]);
```
### ::create() ###
Adds a new progress bar to the container and starts the bar. Returns regular `SingleBar` object which can be individually controlled.
```js
const <barInstance> = <instance>.start(totalValue:int, startValue:int [, payload:object = {}]);
```
### ::remove() ###
Removes an existing bar from the multi progress container.
```js
<instance>.remove(<barInstance>:object);
```
### ::stop() ###
Stops the all progress bars
```js
<instance>.stop();
```
Options
-----------------------------------
The following options can be changed
- `format` (type:string) - progress bar output format @see format section
- `fps` (type:float) - the maximum update rate (default: 10)
- `stream` (type:stream) - output stream to use (default: `process.stdout`)
- `stopOnComplete` (type:boolean) - automatically call `stop()` when the value reaches the total (default: false)
- `clearOnComplete` (type:boolean) - clear the progress bar on complete / `stop()` call (default: false)
- `barsize` (type:int) - the length of the progress bar in chars (default: 40)
- `align` (type:char) - position of the progress bar - 'left' (default), 'right' or 'center'
- `barCompleteChar` (type:char) - character to use as "complete" indicator in the bar (default: "=")
- `barIncompleteChar` (type:char) - character to use as "incomplete" indicator in the bar (default: "-")
- `hideCursor` (type:boolean) - hide the cursor during progress operation; restored on complete (default: false) - pass `null` to keep terminal settings
- `linewrap` (type:boolean) - disable line wrapping (default: false) - pass `null` to keep terminal settings; pass `true` to add linebreaks automatically (not recommended)
- `etaBuffer` (type:int) - number of updates with which to calculate the eta; higher numbers give a more stable eta (default: 10)
- `synchronousUpdate` (type:boolean) - trigger redraw during `update()` in case threshold time x2 is exceeded (default: true)
Bar Formatting

@@ -130,0 +234,0 @@ -----------------------------------

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