Node.js console.log - Is it possible to update a line rather than create a new line?

后端 未结 6 2066
Happy的楠姐
Happy的楠姐 2020-12-07 12:16

My node.js application has a lot of console logs, which are important for me to see (it\'s quite a big app so runs for a long time and I need to know that thing

6条回答
  •  粉色の甜心
    2020-12-07 13:09

    Following @michelek's answer, you can use a function somewhat like this:

    function printProgress(progress){
        process.stdout.clearLine();
        process.stdout.cursorTo(0);
        process.stdout.write(progress + '%');
    }
    

提交回复
热议问题