Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/432.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Nodejs,如何在同一行上显示和更新文本,如运行时钟或下载速度?_Javascript_Node.js_Terminal_Console - Fatal编程技术网

Javascript 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);

在nodejs中,如何在同一行上显示和更新文本,如运行时钟或当前下载速度

“严格使用”;
const rl=require('readline');
函数clearLine(){
rl.cursorTo(process.stdout,0);
rl.clearLine(process.stdout,0);
}
设置间隔(()=>{
clearLine();
process.stdout.write(new Date().toString());
}, 1000);