我正在使用progress
包创建一个进度条。
这是我的代码:
bar = new ProgressBar('fetching :bar :current/:total :percent \n :currentItem \n :blocked \n Fetched: :fetched \n Queued: :queued', { total: numRequests });
bar.tick(0, {
currentItem: `Currently Fetching Text`,
blocked: 'Blocked text',
fetched: 'Fecched Text',
queued: 'Queued Text',
});
在其他应用程序中,我在底部看到一个进度条,用于更新文本,但不会在终端中创建新条目(例如:Yarn的安装栏)。然而,随着progress
我每次打电话给bar.tick
时都会收到一条新消息。是否可以使用progress
只有一条条消息?
这不是一个很好的解决方案(导致屏幕闪烁......)但是有一个清晰的屏幕console.log
console.log('\x1Bc');
把它放在bar.tick
之前