1.0.0 • Published 6 years ago
progressbar-first-version-for-rms v1.0.0
Progress Bar Project
Usage
First we create a ProgressBar,giving it a string and options (if we want)
let ProgressBar = require(`./progressBar`);
const bar = new ProgressBar(':bar',{total: 100}); After this we call 'progress()' appropiately
const timer = setInverval(function(){
bar.progress();
if(bar.complete) {
console.log('\n Finished!');
clearInterval(timer);
}
})Options
There are options that you can pass to the progress bar beside
total that was used in the exemple above.
currentcurrent completed indextotaltotal length of the barwidththe displayed width of the progress bar defaulting to totalstreamthe output stream defaulting to stderrheadhead character defaulting to complete charactercompletecompletion character defaulting to "-"incompleteincomplete character defaulting to "+"renderRuleminimum time between updates in milliseconds defaulting to 50timeoutif the response is later than the set timeout then the progress bar will progress with 1% each time the timeout expirescallbackoptional function to call when the progress bar completes
Tokens
These are the tokens you can use for your progress bar
:barthe progress bar itself:currentcurrent progress position:totaltotal progressed:elapsedtime elapsed in seconds:percentcompletion percentage:etaestimated completion time in seconds:raterate of ticks per second
1.0.0
6 years ago