You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:63](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L63)
3
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:52](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L52)
4
4
5
5
This module provides functions to download and work with downloaded files stored in the application's document directory inside the `react-native-executorch/` directory.
6
6
These utilities can help you manage your storage and clean up the downloaded files when they are no longer needed.
@@ -17,67 +17,50 @@ These utilities can help you manage your storage and clean up the downloaded fil
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:64](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L64)
24
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:118](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L118)
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:284](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L284)
33
-
34
-
Cancels an ongoing/paused download of files.
35
-
36
-
#### Parameters
26
+
Filesystem utilities for reading downloaded resources.
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:327](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L327)
46
+
A promise that resolves to the file contents as a string.
57
47
58
-
Deletes downloaded resources from the local filesystem.
48
+
##### Remarks
59
49
60
-
#### Parameters
50
+
**REQUIRED**: Used internally for reading configuration files (e.g., tokenizer configs).
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:74](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L74)
63
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:104](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L104)
81
64
82
65
Fetches resources (remote URLs, local files or embedded assets), downloads or stores them locally for use by React Native ExecuTorch.
83
66
@@ -100,109 +83,72 @@ Multiple resources that can be strings, asset references, or objects.
100
83
`Promise`\<`string`[]\|`null`\>
101
84
102
85
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).
103
-
If the fetch was interrupted by `pauseFetching` or `cancelFetching`, it returns a promise which resolves to `null`.
86
+
If the fetch was interrupted, it returns a promise which resolves to `null`.
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:345](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L345)
94
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:86](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L86)
112
95
113
-
Fetches the info about files size. Works only for remote files.
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:306](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L306)
136
-
137
-
Lists all the downloaded files used by React Native ExecuTorch.
138
-
139
-
#### Returns
106
+
If no adapter has been set via [setAdapter](#setadapter).
140
107
141
-
`Promise`\<`string`[]\>
108
+
#### Remarks
142
109
143
-
A promise, which resolves to an array of URIs for all the downloaded files.
110
+
**INTERNAL**: Used internally by all resource fetching operations.
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:316](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L316)
118
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:73](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L73)
152
119
153
-
Lists all the downloaded models used by React Native ExecuTorch.
120
+
Resets the resource fetcher adapter to null.
154
121
155
122
#### Returns
156
123
157
-
`Promise`\<`string`[]\>
158
-
159
-
A promise, which resolves to an array of URIs for all the downloaded models.
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:261](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L261)
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:273](https://github.com/software-mansion/react-native-executorch/blob/326d6344894d75625c600d5988666e215a32d466/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L273)
136
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcher.ts:63](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcher.ts#L63)
192
137
193
-
Resumes a paused download of files.
138
+
Sets a custom resource fetcher adapter for resource operations.
The adapter instance to use for fetching resources.
202
147
203
148
#### Returns
204
149
205
-
`Promise`\<`void`\>
150
+
`void`
151
+
152
+
#### Remarks
206
153
207
-
If the fetch was successful, it returns a promise which resolves to an array of local file paths for the downloaded resources (without file:// prefix).
208
-
If the fetch was again interrupted by `pauseFetching` or `cancelFetching`, it returns a promise which resolves to `null`.
154
+
**INTERNAL**: Used by platform-specific init functions (expo/bare) to inject their fetcher implementation.
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:23](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L23)
4
+
5
+
Download status of the file.
6
+
7
+
## Enumeration Members
8
+
9
+
### ONGOING
10
+
11
+
> **ONGOING**: `0`
12
+
13
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:27](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L27)
14
+
15
+
Download is still in progress.
16
+
17
+
---
18
+
19
+
### PAUSED
20
+
21
+
> **PAUSED**: `1`
22
+
23
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:32](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L32)
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:8](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L8)
4
+
5
+
Http status codes
6
+
7
+
## Enumeration Members
8
+
9
+
### OK
10
+
11
+
> **OK**: `200`
12
+
13
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:11](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L11)
14
+
15
+
- Everything is ok.
16
+
17
+
---
18
+
19
+
### PARTIAL_CONTENT
20
+
21
+
> **PARTIAL_CONTENT**: `206`
22
+
23
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:15](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L15)
24
+
25
+
- Server has fulfilled a client request for a specific part of a resource, instead of sending the entire file.
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:40](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L40)
4
+
5
+
Types of sources that can be downloaded
6
+
7
+
## Enumeration Members
8
+
9
+
### DEV_MODE_FILE
10
+
11
+
> **DEV_MODE_FILE**: `3`
12
+
13
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:59](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L59)
14
+
15
+
Represents a file served via the metro bundler during development.
16
+
17
+
---
18
+
19
+
### LOCAL_FILE
20
+
21
+
> **LOCAL_FILE**: `1`
22
+
23
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:49](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L49)
24
+
25
+
Represents a file stored locally on the filesystem.
26
+
27
+
---
28
+
29
+
### OBJECT
30
+
31
+
> **OBJECT**: `0`
32
+
33
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:44](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L44)
34
+
35
+
Represents a raw object or data structure.
36
+
37
+
---
38
+
39
+
### RELEASE_MODE_FILE
40
+
41
+
> **RELEASE_MODE_FILE**: `2`
42
+
43
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:54](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L54)
44
+
45
+
Represents a file bundled with the application in release mode.
46
+
47
+
---
48
+
49
+
### REMOTE_FILE
50
+
51
+
> **REMOTE_FILE**: `4`
52
+
53
+
Defined in: [packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts:64](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/utils/ResourceFetcherUtils.ts#L64)
Defined in: [packages/react-native-executorch/src/index.ts:32](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/index.ts#L32)
6
+
7
+
Function that cleans current setup of fetching resources.
Defined in: [packages/react-native-executorch/src/index.ts:23](https://github.com/software-mansion/react-native-executorch/blob/9db6e3b8b0f1b11ef66f7c45d29a251b31e9c252/packages/react-native-executorch/src/index.ts#L23)
6
+
7
+
Function that setups the provided resource fetcher.
0 commit comments