Home

Awesome

xprogress

Construct Dynamic, Flexible, extensible progressive CLI bar for the terminal built with NodeJS

DOCUMENTATION INCOMPLETE

Features

NPM Version NPM Downloads

NPM

Installing

Via NPM:

npm install xprogress

Usage

Create a basic progress bar that updates itself with 10% twice every second until it's at maximum

import ProgressBar from 'xprogress';

const ProgressBar = require('xprogress');

const bar = new ProgressBar(100);

const interval = setInterval(() => {
  bar.tick(10).draw();
  if (bar.isComplete()) {
    bar.end(`The bar completed\n`);
    clearInterval(interval);
  }
}, 500);

XProgress Example Result

How It Works

ProgressBar uses stringd to parse content within ProgressBar::template with variables in ProgressBar::variables and then displays them on the terminal. This sequence occurs for every time ProgressBar::draw() is called.

API

<a id="progressbar"></a> new ProgressBar(total[, slots][, opts])

Create and return an xprogress instance slots define the percentage to each part of the progressbar. This is parsed by pad-ratio to a max of 100.

const bar = new ProgressBar(100, [20, 44]);

<a id="globopts"></a> GlobOpts: Object

The global options shared by both ProgressBar and ProgressStream.

<a id="variableopts"></a> VariableOpts <sub>extends cStringd.raw</sub>: Object

Variables with which to parse this.template, extended with cStringd.raw. variables prepended with * will be ignored anywhere else besides wherever's explicitly requesting a drawn bar.

<a id="streamvariables"></a> StreamVariables <sub>extends VariableOpts</sub>: Object

<a id='hybridinput'></a> HybridInput: string|number|number[]

This content here is parsed by pad-ratio in the construct of an HybridInput.

Development

Building

Feel free to clone, use in adherance to the license. Pull requests are very much welcome.

git clone https://github.com/miraclx/xprogress.git
cd xprogress
npm install
# hack on code

License

Apache 2.0 © Miraculous Owonubi (@miraclx) <omiraculous@gmail.com>