Node.js: printing to console without a trailing newline?

后端 未结 8 2201
-上瘾入骨i
-上瘾入骨i 2020-11-28 00:27

Is there a method for printing to the console without a trailing newline? The console object documentation doesn\'t say anything regarding that:

8条回答
  •  攒了一身酷
    2020-11-28 00:37

    None of these solutions work for me, process.stdout.write('ok\033[0G') and just using '\r' just create a new line but don't overwrite on Mac OSX 10.9.2.

    EDIT: I had to use this to replace the current line:

    process.stdout.write('\033[0G');
    process.stdout.write('newstuff');
    

提交回复
热议问题