Node.Js on windows - How to clear console

前端 未结 19 1561
迷失自我
迷失自我 2020-12-02 08:51

Being totally new into node.js environment and philosophy i would like answers to few questions. I had downloaded the node.js for windows installer and also node package man

19条回答
  •  囚心锁ツ
    2020-12-02 09:10

    Haven't tested this on Windows but works on unix. The trick is in the child_process module. Check the documentation. You can save this code as a file and load it to the REPL every time you need it.

    var util = require('util');
    var exec = require('child_process').exec;
    
    function clear(){
        exec('clear', function(error, stdout, stderr){
            util.puts(stdout);
        });    
    }
    

提交回复
热议问题