Add CLI option to display progress bars #11

Merged
greg merged 6 commits from feature/progress_bars into chore/upgrade_kredits 2022-11-02 17:39:21 +00:00
Showing only changes of commit 03ee17f00e - Show all commits

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;
}