How to erase characters printed in console

前端 未结 6 1139
被撕碎了的回忆
被撕碎了的回忆 2020-12-22 19:03

I\'ve been searching how to do it in other languages and I\'ve found that I have to use the special character \\b to remove the last character. (how-do-i-erase-printed-chara

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-22 19:09

    The easiest way to overwrite the same line is

    var dots = ...
    process.stdout.write('Progress: '+dots+'\r');
    

    the \r is the key. It will move the cursor back to the beginning of the line.

提交回复
热议问题