Defined in: utils/ResourceFetcher.ts:77
This module provides functions to download and work with downloaded files stored in the application's document directory inside the react-native-executorch/ directory.
These utilities can help you manage your storage and clean up the downloaded files when they are no longer needed.
new ResourceFetcher():
ResourceFetcher
ResourceFetcher
staticfs:object
Defined in: utils/ResourceFetcher.ts:155
Filesystem utilities for reading downloaded resources.
readAsString: (
path) =>Promise<string>
Reads the contents of a file as a string.
string
Absolute file path to read.
Promise<string>
A promise that resolves to the file contents as a string.
REQUIRED: Used internally for reading configuration files (e.g., tokenizer configs).
Provides access to filesystem operations through the configured adapter. Currently supports reading file contents as strings for configuration files.
staticfetch(callback?, ...sources):Promise<string[] |null>
Defined in: utils/ResourceFetcher.ts:128
Fetches resources (remote URLs, local files or embedded assets), downloads or stores them locally for use by React Native ExecuTorch.
(downloadProgress) => void
Optional callback to track progress of all downloads, reported between 0 and 1.
...ResourceSource[]
Multiple resources that can be strings, asset references, or objects.
Promise<string[] | null>
If the fetch was successful, it returns a promise which resolves to an array of local file paths for the downloaded/stored resources (without file:// prefix).
If the fetch was interrupted, it returns a promise which resolves to null.
staticgetAdapter():ResourceFetcherAdapter
Defined in: utils/ResourceFetcher.ts:107
Gets the current resource fetcher adapter instance.
The configured ResourceFetcherAdapter instance.
If no adapter has been set via setAdapter.
INTERNAL: Used internally by all resource fetching operations.
staticresetAdapter():void
Defined in: utils/ResourceFetcher.ts:96
Resets the resource fetcher adapter to null.
void
INTERNAL: Used primarily for testing purposes to clear the adapter state.
staticsetAdapter(adapter):void
Defined in: utils/ResourceFetcher.ts:87
Sets a custom resource fetcher adapter for resource operations.
The adapter instance to use for fetching resources.
void
INTERNAL: Used by platform-specific init functions (expo/bare) to inject their fetcher implementation.