Skip to content

Instantly share code, notes, and snippets.

@chrisallenlane
Created June 18, 2014 02:42
Show Gist options
  • Save chrisallenlane/ad60133f7c0921fa8108 to your computer and use it in GitHub Desktop.
Save chrisallenlane/ad60133f7c0921fa8108 to your computer and use it in GitHub Desktop.
Console progress meter in nodejs
counter = 0;
setInterval(go, 250);
function go() {
counter++;
// This is the interesting line
process.stdout.write("Task is " + counter * 10 + "% complete.\r");
if(counter >= 10) {
console.log();
process.exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment