@toast-studios/asset-manager
Version:
A React Native asset management library with intelligent caching and loading strategies
50 lines (49 loc) • 1.31 kB
TypeScript
import { AssetBundle, DownloadProgress, EventCallback } from '../types/index';
import { StorageManager } from './StorageManager';
/**
* Download manager for handling asset bundle downloads and extraction
*/
export declare class DownloadManager {
private storageManager;
private activeDownloads;
private downloadCallbacks;
private enableLogging;
private customHeaders;
constructor(storageManager: StorageManager, enableLogging?: boolean, customHeaders?: Record<string, string>);
/**
* Download and extract a bundle
*/
downloadBundle(bundle: AssetBundle, progressCallback?: EventCallback<DownloadProgress>): Promise<void>;
/**
* Cancel all active downloads
*/
cancelAllDownloads(): void;
/**
* Get number of active downloads
*/
getActiveDownloadCount(): number;
/**
* Download a file with progress tracking
*/
private downloadFile;
/**
* Extract a downloaded bundle
*/
private extractBundle;
/**
* Emit download progress event
*/
private emitProgress;
/**
* Cleanup temporary files
*/
cleanupTempFiles(): Promise<void>;
/**
* Log message if logging is enabled
*/
private log;
/**
* Cleanup resources
*/
destroy(): void;
}