UNPKG

ipull

Version:

The only file downloader you'll ever need. For node.js and the browser, CLI and library for fast and reliable file downloads.

45 lines (44 loc) 1.89 kB
import BaseDownloadEngine from "../download-engine/engine/base-download-engine.js"; import { EventEmitter } from "eventemitter3"; import { FormattedStatus } from "./format-transfer-status.js"; import DownloadEngineFile from "../download-engine/download-file/download-engine-file.js"; import { DownloadStatus } from "../download-engine/download-file/progress-status-file.js"; import DownloadEngineMultiDownload from "../download-engine/engine/download-engine-multi-download.js"; import { DownloadEngineRemote } from "../download-engine/engine/DownloadEngineRemote.js"; export type ProgressStatusWithIndex = FormattedStatus & { index: number; }; interface CliProgressBuilderEvents { progress: (progress: ProgressStatusWithIndex) => void; } export type AnyEngine = DownloadEngineFile | BaseDownloadEngine | DownloadEngineMultiDownload | DownloadEngineRemote; export default class ProgressStatisticsBuilder extends EventEmitter<CliProgressBuilderEvents> { private _engines; private _activeTransfers; private _totalBytes; private _transferredBytes; private _latestEngine; private _activeDownloadPart; private _startTime; private _statistics; private _lastStatus; private _downloadStatus; private _endTime; private _downloadId; private _allFileNames; private _retrying; private _retryingTotalAttempts; private _streamsNotResponding; constructor(); get downloadStatus(): DownloadStatus; set downloadStatus(status: DownloadStatus); get totalBytes(): number; get transferredBytesWithActiveTransfers(): number; get status(): ProgressStatusWithIndex; add(engine: AnyEngine, sendProgress?: boolean): void; private _sendProgress; private createStatus; static oneStatistics(engine: DownloadEngineFile): FormattedStatus; static loadingStatusEmptyStatistics(): FormattedStatus; } export {};