From a node.js tutorial, I see those two process.stdout functions :
process.stdout.clearLine();
process.stdout.cursorTo(0);
But I\'m using
This is the solution :
First, require readline :
var readline = require('readline');
Then, use cursorTo like this :
function writeWaitingPercent(p) {
//readline.clearLine(process.stdout);
readline.cursorTo(process.stdout, 0);
process.stdout.write(`waiting ... ${p}%`);
}
I've commented clearLine, since it's useless in my case (cursorTo move back the cursor to the start)