Fix progress bar rendering when finished

This commit is contained in:
Râu Cao 2022-11-02 13:34:51 +01:00
parent 9dffb15f45
commit 03ee17f00e
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
1 changed files with 7 additions and 0 deletions

View File

@ -1,6 +1,10 @@
const debug = require('debug')('ipfs-pinner');
const cliProgress = require('cli-progress');
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
class IpfsPinner {
constructor (kredits, options={}) {
this.kredits = kredits;
@ -46,6 +50,9 @@ class IpfsPinner {
await Promise.all(promises);
// Avoid console output race condition with progress bars finishing update
if (this.progressBars) await sleep(1000);
return cids;
}