process.stdout.clearLine()
deletes latest line. How can I delete all lines from stdout
?
var out = process.stdout;
out.write("1\n"); // prints `1` and new line
out.write("2"); // prints `2`
setTimeout(function () {
process.stdout.clearLine(); // clears the latest line (`2`)
out.cursorTo(0); // moves the cursor at the beginning of line
out.write("3"); // prints `3`
out.write("\n4"); // prints new line and `4`
console.log();
}, 1000);
The output is:
1
3
4
I want to delete all lines from stdout
instead of latest line, so the output will be:
3
4