A cli progress bar based on ora library.
const ProgressBar = require("ora-progress-bar");
const progressBar = new ProgressBar("Current Progress", 100);
The options parameter is optional if you want to customize the ora spinner you can pass them see.
progressBar.progress();
progressBar.progress(5);
By default when the progressBar reaches its goal, it stops and succeeds. But you can force them to fail or succeed manually.
try {
// do stuff
progressBar.progress();
} catch (e) {
progressBar.fail();
}
if (flag) {
progressBar.succeed();
} else {
progressBar.progress();
}
if (newWorkReceived) progressBar.updateGoal(progressBar.goal + newWork.length);
if (batchFailed) progressBar.updateProgress(0);
Only one progress bar can be active at a time.