[Node.js] I CANNOT clear the console at the same line.
tingwei628 (0)

Here is the code.

var readline = require("readline");
var i = 0;
setInterval(function () {
	readline.cursorTo(process.stdout, 0);
	readline.clearLine();
	process.stdout.write(i.toString());
	i++;
}, 300);
You are viewing a single comment. View All
eankeen (605)

hello!

yes, the current tty interface is sometimes broken when dealing with clearing certain lines (and even the whole screen). this is a known issue. when programming a python repl, repl.it has a custom library you can import that clears the whole screen. unfortunately, no such solution is available for node.

hope i was able to help :)