Node.js console.log – Is it possible to update a line rather than create a new line?

Try playing with process.stdout methods instead on console:

process.stdout.write("Hello, World");
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write("\n"); // end the line

TypeScript: clearLine() takes -1, 0, or 1 as a direction parameter with the following meanings:

-1: to the left from cursor.
0: the entire line.
1 – to the right from cursor

Leave a Comment