comic-book-dl
Version:
38 lines (37 loc) • 1.24 kB
TypeScript
import cliProgress, { SingleBar } from 'cli-progress';
export interface IProgressItem {
name: string;
rawName: string;
index: number;
path: string;
href: string;
imageList: string[];
imageListPath: string[];
}
export type IProgress = IProgressItem[];
export default class ProgressBar {
bookPath: string;
progressFilePath: string;
progressInfo: IProgress;
curr: number;
total: number;
isDownloadInterrupted: boolean;
multiBar: cliProgress.MultiBar | null;
bar: cliProgress.SingleBar | null;
completePromise: Promise<void> | null;
ignoreConsole: boolean;
constructor(bookPath: string, total: number, ignoreConsole?: boolean);
init(): Promise<void>;
getProgress(): Promise<IProgress>;
updateProgress(progressItem: IProgressItem, isSuccess: boolean): Promise<void>;
resetProgressInfo(updateProgressInfo: IProgressItem[]): Promise<void>;
multiBarCreate(params: {
total: number;
file: string;
}): cliProgress.SingleBar | undefined;
multiBarUpdate(curBar: SingleBar | undefined): void;
multiBarRemove(curBar: SingleBar | undefined): void;
pause(): void;
continue(line: number): void;
clearLine(line: number): void;
}