Skip to content

Instantly share code, notes, and snippets.

@latpaw
Created May 22, 2020 02:28
Show Gist options
  • Save latpaw/76ac753124130771d2171668c47a2396 to your computer and use it in GitHub Desktop.
Save latpaw/76ac753124130771d2171668c47a2396 to your computer and use it in GitHub Desktop.
processbar
echo -ne "-1\r"
sleep 1
echo -ne "--2\r"
sleep 1
echo -ne "---3\r"
const readline = require('readline');
let count = 0;
function echo () {
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(count.toString()+'%')
if(count> 99) return;
count++;
setTimeout(()=>{
echo()
}, 50)
}
echo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment