A CLI progress bar
npm install bottom-barshell
npm install bottom-bar
`
##### yarn:
`shell
yarn add bottom-bar
`
$3
`javascript
const BottomBar = require('bottom-bar');
const bottomBar = BottomBar();
const max = 200;
for (let curr = 0; curr < max; curr += 10)
{
bottomBar.update(curr, max);
// Sleep - Here is your part of code
await new Promise(resolve => {setTimeout(resolve, 1000)});
}
bottomBar.destroy();
`
$3
const bottomBar = BottomBar(options);
Creates a new BottomBar instance
- options (Object)
- returns BottomBar
#### Options
- barsize: (Number) A length of progress bar. Defaults: 40
- barCompleteChar: (String) Character to use as "complete" indicator in the bar (default: "ਜ")
- barIncompleteChar: (String) Character to use as "incomplete" indicator in the bar (default: "u2591;")
- format: (String) progress bar output format @see format section
#### Bar Formatting
The progressbar can be customized by using the following build-in placeholders. They can be combined in any order.
- {bar} - the progress bar, customizable by the options barsize, barCompleteChar and barIncompleteChar
- {percentage} - the current progress in percent (0-100)
- {total} - the end value
- {value} - the current value set by last update() call
Custom values can be passed by update call:
`javascript
const bottomBar = BottomBar({
format: 'Progress |' + Colors.cyan('{bar}') + '| {percentage}% | {value}/{total} | {customValue}',
});
bottomBar.update(value, total, {
customValue: 'test',
});
``