Created
February 19, 2013 22:51
-
-
Save 19h/4990953 to your computer and use it in GitHub Desktop.
Node.js — Clear Terminal / Console. Reset to initial state.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.reset = function () { | |
return process.stdout.write('\033c'); | |
} |
The combinations
Ctrl + L
reset the full log.Ctrl + L to clear screen - https://unix.stackexchange.com/questions/104094/is-there-any-way-to-enable-ctrll-to-clear-screen-when-set-o-vi-is-set
thanks
Thank you.
If anyone is wondering when/how to call the function, the following is working for me :
app.listen(process.env.PORT || 3000,function (){
process.stdout.write('\033c');
}
since app.listen accepts a callback method, hope this helps someone ! :)
Thank you @TemaSM, its beautiful
Works on macOS Big Sur 😸
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, its work on windows 10