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)