gs-download
Version:
Downloader of Genius Scan PDFs files
33 lines • 1.02 kB
JavaScript
import { MultiBar } from 'cli-progress';
export default class ProgressManager {
constructor() {
this.multiBar = new MultiBar({
format: '{name} | {bar} | {percentage}% | {value} / {total}',
clearOnComplete: false,
hideCursor: true,
barCompleteChar: '\u2588',
barIncompleteChar: '\u2591',
});
this.bars = new Map();
}
create(name, total) {
this.bars.set(name, this.multiBar.create(total, 0, { name }));
}
update(name, value = null) {
var _a, _b;
if (value === null) {
(_a = this.bars.get(name)) === null || _a === void 0 ? void 0 : _a.increment();
}
else {
(_b = this.bars.get(name)) === null || _b === void 0 ? void 0 : _b.update(value);
}
}
done(name) {
this.multiBar.remove(this.bars.get(name));
this.bars.delete(name);
}
stop() {
this.multiBar.stop();
}
}
//# sourceMappingURL=progress-manager.js.map