
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
progress-bar-cli
Advanced tools
A CLI ProgressBar for nodeJS and JS to monitor any long running job/process in a loop and alert the user with sound notification when the task ends.
CLI Progress Bar for NodeJS and JavaScript to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code
Did you ever encounter long running processes or jobs running inside loops in javascript or nodejs? Did you ever encounter tasks where nodejs scripts are running in a server, making multiple api calls in long running loops?
If you are tired of sitting and waiting for these processes and not knowing when this kind of job/loop will end. If you want to have a metrics that will show you the current iteration number of the loop, eta of the job, time elapsed, time to finish, estimated total time along with a cool cli progress bar, and even notify you with an alert sound when the job ends... then you are at the right place!
Here is a running demo of the cli progress bar below:

The function progressBar() can be applied to any determinate loop with finite and determined loop_len.
It has the following features:
Available matrices:
Here are some of the ascii styles you can choose from:
style=0

style=1

style=2

style=3

style=4

npm i progress-bar-cli
const progressBar = require("progress-bar-cli");
let loop_len = 1000;
let startTime = new Date();
for (i = 0; i < loop_len; ++i) {
// call progressBar at the start of the loop block
progressBar.progressBar(i, loop_len, startTime);
/** START OF LONG RUNNING JOB/PROCESS IN LOOP*/
//
// Insert your CODE Here!!
//
/** END OF LONG RUNNING JOB/PROCESS IN LOOP*/
}
If the job get's haulted in the middle or if the Job was multiple API calls in a loop, and maybe due to network issues the process got haulted,
you can trace the last iteration of the running job from log files (if you are maintaining any), and resume the job from that ith iteration using the following code:
const progressBar = require("progress-bar-cli");
let resumeFrom = 50;
let loop_len = 1000;
let startTime = new Date();
for (i = 0; i < loop_len; ++i) {
// call progressBar at the start of the loop block
progressBar.progressBar(i, loop_len, startTime);
// code to skip to the ith iteration and continue from there
if (i < resumeFrom) {
console.log("> skipping", i);
continue;
}
/** START OF LONG RUNNING JOB/PROCESS IN LOOP*/
//
// Insert your CODE Here!!
//
/** END OF LONG RUNNING JOB/PROCESS IN LOOP*/
}
| Parameter Name | Data Type | default value | description |
|---|---|---|---|
| currentStep | {Number} | *required | the current iteration number in the loop. eg: i, index or count |
| totalSteps | {Number} | *required | total number of steps that the loop will run for. |
| startTime | {Date} | *required | pass the start time of the loop. It should be a Date object. eg: 'new Date()' |
| clearScreenEvery | {Number} | 1 | console to be cleared off every ith iteration of this value. |
| barLength | {Number} | 50 | the length of the progress bar. |
| style | {Number} | 4 | choose styles from 0 - 4. |
| notify | {Boolean} | false | set true for sound alert notification when complete. false to turn it off |
| function return | {Number} | NA | currentStep++ |
Please Note: * are the three required parameters for the function
Below are some of the example codes where progressBar is used.
const progressBar = require("progress-bar-cli");
// Main for testing the Progress Bar!
let loop_len = 100;
let counter = 0;
let resumeFrom = 0;
let startTime = new Date();
console.time("total system time");
for (i = 0; i < loop_len; ++i) {
counter = progressBar.progressBar(counter, loop_len, startTime);
if (counter < resumeFrom) {
console.log("> skipping", counter);
continue;
}
// do some time consuming task in loop
var waitTill = new Date(new Date().getTime() + 100);
while(waitTill > new Date()){}
}
console.timeEnd("total system time");
const progressBar = require("progress-bar-cli");
// Main for testing the Progress Bar!
let loop_len = 100;
let counter = 0;
let startTime = new Date();
console.time("total system time");
while (counter < loop_len) {
counter = progressBar.progressBar(counter, loop_len, startTime);
// do some time consuming task in loop
var waitTill = new Date(new Date().getTime() + 100);
while(waitTill > new Date()){}
}
console.timeEnd("total system time");
TODO: add examples in readme for forEach, for/in, for/of, do/while and other types of loops in js and node
TODO: add support for async loops in js and node
TODO: add support for Indeterminate loops in js and node
TODO: add features to make the cli UI even better
TODO: add color and spinner if the running console/cli supports colorization
TODO: improve the sound alert and support for all OS without any package dependency
TODO: replace sound alert system to something different and useful (based on community feedback!)
(as the sound feature is not that useful for systems running in server, vm or pipeline based applications)
FAQs
A CLI ProgressBar for nodeJS and JS to monitor any long running job/process in a loop and alert the user with sound notification when the task ends.
The npm package progress-bar-cli receives a total of 131 weekly downloads. As such, progress-bar-cli popularity was classified as not popular.
We found that progress-bar-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.