Flexible ascii progress bar with smooth progress using 9 different head characters.
Installation
$ npm install progress-softbar
Usage
Same like the original progress bar but without the options head, complete and incomplete which are now set during runtime.
First we create a ProgressBar
, giving it a format string
as well as the total
, telling the progress bar when it will
be considered complete. After that all we need to do is tick()
appropriately.
var ProgressBar = require('progress-softbar');
var bar = new ProgressBar(':bar', { total: 200,width: 20 });
var timer = setInterval(function () {
bar.tick();
if (bar.complete) {
console.log('\ncomplete\n');
clearInterval(timer);
}
}, 50);
Example
checking ▕██▏ ▏
Options
These are keys in the options object you can pass to the progress bar along with
total
as seen in the example above.
curr
current completed indextotal
total number of ticks to completewidth
the displayed width of the progress bar defaulting to totalstream
the output stream defaulting to stderrrenderThrottle
minimum time between updates in milliseconds defaulting to 16clear
option to clear the bar on completion defaulting to falsecallback
optional function to call when the progress bar completes
For more insctructions have a look on the original progress bar at https://www.npmjs.com/package/progress .
License
MIT