/** * Resource Fetcher for Expo applications. * * This module provides functions to download and manage files stored in the application's document directory * inside the `react-native-executorch/` directory. These utilities help manage storage and clean up downloaded * files when they are no longer needed. * @category Utilities - General * @remarks * **Key Functionality:** * - **Download Control**: Pause, resume, and cancel operations through: * - {@link pauseFetching} - Pause ongoing downloads * - {@link resumeFetching} - Resume paused downloads * - {@link cancelFetching} - Cancel ongoing or paused downloads * - **File Management**: * - {@link getFilesTotalSize} - Get total size of resources * - {@link listDownloadedFiles} - List all downloaded files * - {@link listDownloadedModels} - List downloaded model files (.pte) * - {@link deleteResources} - Delete downloaded resources * * **Important Notes:** * - Pause/resume/cancel operations work only for remote resources * - Most functions accept multiple `ResourceSource` arguments (string, number, or object) * - The {@link fetch} method accepts a progress callback (0-1) and returns file paths or throws if interrupted */ import { ResourceSource, BaseResourceFetcherClass } from 'react-native-executorch/legacy'; import { type ActiveDownload } from './handlers'; declare class ExpoResourceFetcherClass extends BaseResourceFetcherClass { protected downloads: Map; protected getFilesSizes(sources: ResourceSource[]): Promise<{ results: { source: ResourceSource; type: import("react-native-executorch/legacy").SourceType; length: number; previousFilesTotalLength: number; }[]; totalLength: number; }>; protected handleObject(source: object): Promise; protected handleLocalFile(source: string): string; protected handleAsset(source: number, progressCallback: (progress: number) => void): Promise; protected handleRemote(uri: string, source: ResourceSource, progressCallback: (progress: number) => void): Promise<{ path: string; wasDownloaded: boolean; }>; protected pause(source: ResourceSource): Promise; protected resume(source: ResourceSource): Promise; protected cancel(source: ResourceSource): Promise; /** * Reads the contents of a file as a string. * @param path - Absolute file path or file URI to read. * @returns A promise that resolves to the file contents as a string. */ readAsString(path: string): Promise; /** * Lists all the downloaded files used by React Native ExecuTorch. * @returns A promise that resolves to an array of URIs for all the downloaded files. */ listDownloadedFiles(): Promise; /** * Deletes downloaded resources from the local filesystem. * @param sources - The resource identifiers used when calling `fetch`. * @returns A promise that resolves once all specified resources have been removed. */ deleteResources(...sources: ResourceSource[]): Promise; /** * Fetches the total size of remote files. Works only for remote files. * @param sources - The resource identifiers (URLs). * @returns A promise that resolves to the combined size of files in bytes. */ getFilesTotalSize(...sources: ResourceSource[]): Promise; } export declare const ExpoResourceFetcher: ExpoResourceFetcherClass; export {}; //# sourceMappingURL=ResourceFetcher.d.ts.map