I tried implementing it with console.clear(), but in my tests the results can be very strange.
I suspect if you used a mix of stdout.write, stderr.write and console.log, then calling console.clear will only be able to overwrite some of stdout, and other stuff will remain visible.
It might be doable with better results if I avoid using console.log altogether and do all logging with stdout.write, and then overwrite stdout contents manually. Something to explore.
I tried implementing it with
console.clear(), but in my tests the results can be very strange.I suspect if you used a mix of
stdout.write,stderr.writeandconsole.log, then callingconsole.clearwill only be able to overwrite some ofstdout, and other stuff will remain visible.It might be doable with better results if I avoid using
console.logaltogether and do all logging withstdout.write, and then overwritestdoutcontents manually. Something to explore.