1.0.0 • Published 7 years ago
@ngmikeng/node-console-rateprogressbar v1.0.0
node-console-rateprogressbar
A simple function for showing a progress bar in node console.
Setup
$ npm install @ngmikeng/node-console-rateprogressbar --saveExample
const { progressBar } = require('@ngmikeng/node-console-rateprogressbar');
const total = 100;
let currentProgress = 0;
const inter = setInterval(() => {
currentProgress++;
const curRate = currentProgress / total;
if (currentProgress <= total) {
const opts = { label: 'Loading: ', symbol: '#'};
progressBar(curRate, opts);
} else {
clearInterval(inter);
console.log('\n');
}
}, 100);The console will show:
Loading: [##################################################] | 100.00%Options
- label (
string): Show label on the left of progress bar, leavenullorundefinedfor hiding. - symbol (
string): Define a symbol show on progress bar, default is=. - showPercentageProgress (
boolean): Show or hide percentage number, defaulttrue.
License
MIT
1.0.0
7 years ago