Created
May 22, 2020 02:28
-
-
Save latpaw/76ac753124130771d2171668c47a2396 to your computer and use it in GitHub Desktop.
processbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -ne "-1\r" | |
sleep 1 | |
echo -ne "--2\r" | |
sleep 1 | |
echo -ne "---3\r" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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