Javascript Nodejs,如何在同一行上显示和更新文本,如运行时钟或下载速度?
在nodejs中,如何在同一行上显示和更新文本,如运行时钟或当前下载速度Javascript Nodejs,如何在同一行上显示和更新文本,如运行时钟或下载速度?,javascript,node.js,terminal,console,Javascript,Node.js,Terminal,Console,在nodejs中,如何在同一行上显示和更新文本,如运行时钟或当前下载速度 “严格使用”; const rl=require('readline'); 函数clearLine(){ rl.cursorTo(process.stdout,0); rl.clearLine(process.stdout,0); } 设置间隔(()=>{ clearLine(); process.stdout.write(new Date().toString()); }, 1000);
“严格使用”;
const rl=require('readline');
函数clearLine(){
rl.cursorTo(process.stdout,0);
rl.clearLine(process.stdout,0);
}
设置间隔(()=>{
clearLine();
process.stdout.write(new Date().toString());
}, 1000);