capacitor-native-update
Version:
Native Update Plugin for Capacitor
68 lines (67 loc) • 1.76 kB
TypeScript
import type { DownloadProgressEvent } from '../definitions';
/**
* Manages file downloads with progress tracking and resume capability
*/
export declare class DownloadManager {
private activeDownloads;
private readonly logger;
private readonly configManager;
private filesystem;
constructor();
/**
* Initialize the download manager
*/
initialize(): Promise<void>;
/**
* Validate URL against allowed hosts
*/
private validateUrl;
/**
* Download a file with progress tracking
*/
download(url: string, bundleId: string, onProgress?: (event: DownloadProgressEvent) => void): Promise<Blob>;
/**
* Validate content type
*/
private isValidContentType;
/**
* Validate blob size
*/
private validateBlobSize;
/**
* Cancel a download
*/
cancelDownload(bundleId: string): void;
/**
* Cancel all active downloads
*/
cancelAllDownloads(): void;
/**
* Check if a download is active
*/
isDownloading(bundleId: string): boolean;
/**
* Get active download count
*/
getActiveDownloadCount(): number;
/**
* Download with retry logic
*/
downloadWithRetry(url: string, bundleId: string, onProgress?: (event: DownloadProgressEvent) => void): Promise<Blob>;
/**
* Convert blob to ArrayBuffer
*/
blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
/**
* Save blob to filesystem
*/
saveBlob(bundleId: string, blob: Blob): Promise<string>;
/**
* Load blob from filesystem
*/
loadBlob(bundleId: string): Promise<Blob | null>;
/**
* Delete blob from filesystem
*/
deleteBlob(bundleId: string): Promise<void>;
}