1.0.0 • Published 5 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.
current
current completed indextotal
total length of the barwidth
the displayed width of the progress bar defaulting to totalstream
the output stream defaulting to stderrhead
head character defaulting to complete charactercomplete
completion character defaulting to "-"incomplete
incomplete character defaulting to "+"renderRule
minimum time between updates in milliseconds defaulting to 50timeout
if the response is later than the set timeout then the progress bar will progress with 1% each time the timeout expirescallback
optional function to call when the progress bar completes
Tokens
These are the tokens you can use for your progress bar
:bar
the progress bar itself:current
current progress position:total
total progressed:elapsed
time elapsed in seconds:percent
completion percentage:eta
estimated completion time in seconds:rate
rate of ticks per second
1.0.0
5 years ago