@amazon-devices/expo-file-system 2.0.1758683737

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.eslintrc.js +2 -0
  2. package/CHANGELOG.md +317 -0
  3. package/CMakeLists.txt +52 -0
  4. package/LICENSE +7 -0
  5. package/README.kepler.md +260 -0
  6. package/README.md +46 -0
  7. package/THIRD_PARTY_NOTICES.txt +24 -0
  8. package/android/build.gradle +118 -0
  9. package/android/src/main/AndroidManifest.xml +17 -0
  10. package/android/src/main/java/expo/modules/filesystem/AppDirectoriesModule.kt +26 -0
  11. package/android/src/main/java/expo/modules/filesystem/CountingRequestBody.kt +52 -0
  12. package/android/src/main/java/expo/modules/filesystem/FilePermissionModule.kt +48 -0
  13. package/android/src/main/java/expo/modules/filesystem/FileSystemExceptions.kt +48 -0
  14. package/android/src/main/java/expo/modules/filesystem/FileSystemFileProvider.kt +5 -0
  15. package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +1110 -0
  16. package/android/src/main/java/expo/modules/filesystem/FileSystemPackage.kt +10 -0
  17. package/android/src/main/java/expo/modules/filesystem/FileSystemRecords.kt +92 -0
  18. package/android/src/main/res/xml/file_system_provider_paths.xml +5 -0
  19. package/app.plugin.js +1 -0
  20. package/build/ExponentFileSystem.d.ts +4 -0
  21. package/build/ExponentFileSystem.d.ts.map +1 -0
  22. package/build/ExponentFileSystem.js +5 -0
  23. package/build/ExponentFileSystem.js.map +1 -0
  24. package/build/ExponentFileSystem.kepler.d.ts +4 -0
  25. package/build/ExponentFileSystem.kepler.d.ts.map +1 -0
  26. package/build/ExponentFileSystem.kepler.js +112 -0
  27. package/build/ExponentFileSystem.kepler.js.map +1 -0
  28. package/build/ExponentFileSystem.web.d.ts +3 -0
  29. package/build/ExponentFileSystem.web.d.ts.map +1 -0
  30. package/build/ExponentFileSystem.web.js +3 -0
  31. package/build/ExponentFileSystem.web.js.map +1 -0
  32. package/build/ExponentFileSystemShim.d.ts +4 -0
  33. package/build/ExponentFileSystemShim.d.ts.map +1 -0
  34. package/build/ExponentFileSystemShim.js +21 -0
  35. package/build/ExponentFileSystemShim.js.map +1 -0
  36. package/build/FileSystem.d.ts +361 -0
  37. package/build/FileSystem.d.ts.map +1 -0
  38. package/build/FileSystem.js +616 -0
  39. package/build/FileSystem.js.map +1 -0
  40. package/build/FileSystem.types.d.ts +304 -0
  41. package/build/FileSystem.types.d.ts.map +1 -0
  42. package/build/FileSystem.types.js +47 -0
  43. package/build/FileSystem.types.js.map +1 -0
  44. package/build/index.d.ts +3 -0
  45. package/build/index.d.ts.map +1 -0
  46. package/build/index.js +3 -0
  47. package/build/index.js.map +1 -0
  48. package/build/types.d.ts +35 -0
  49. package/build/types.d.ts.map +1 -0
  50. package/build/types.js +2 -0
  51. package/build/types.js.map +1 -0
  52. package/expo-module.config.json +11 -0
  53. package/ios/EXFilePermissionModule.h +16 -0
  54. package/ios/EXFilePermissionModule.m +68 -0
  55. package/ios/EXFileSystem.h +25 -0
  56. package/ios/EXFileSystem.m +1084 -0
  57. package/ios/EXFileSystemAssetLibraryHandler.h +6 -0
  58. package/ios/EXFileSystemAssetLibraryHandler.m +142 -0
  59. package/ios/EXFileSystemHandler.h +17 -0
  60. package/ios/EXFileSystemLocalFileHandler.h +7 -0
  61. package/ios/EXFileSystemLocalFileHandler.m +79 -0
  62. package/ios/EXSessionTasks/EXSessionCancelableUploadTaskDelegate.h +16 -0
  63. package/ios/EXSessionTasks/EXSessionCancelableUploadTaskDelegate.m +55 -0
  64. package/ios/EXSessionTasks/EXSessionDownloadTaskDelegate.h +13 -0
  65. package/ios/EXSessionTasks/EXSessionDownloadTaskDelegate.m +64 -0
  66. package/ios/EXSessionTasks/EXSessionHandler.h +19 -0
  67. package/ios/EXSessionTasks/EXSessionHandler.m +49 -0
  68. package/ios/EXSessionTasks/EXSessionResumableDownloadTaskDelegate.h +18 -0
  69. package/ios/EXSessionTasks/EXSessionResumableDownloadTaskDelegate.m +66 -0
  70. package/ios/EXSessionTasks/EXSessionTaskDelegate.h +32 -0
  71. package/ios/EXSessionTasks/EXSessionTaskDelegate.m +58 -0
  72. package/ios/EXSessionTasks/EXSessionTaskDispatcher.h +19 -0
  73. package/ios/EXSessionTasks/EXSessionTaskDispatcher.m +96 -0
  74. package/ios/EXSessionTasks/EXSessionUploadTaskDelegate.h +8 -0
  75. package/ios/EXSessionTasks/EXSessionUploadTaskDelegate.m +52 -0
  76. package/ios/EXSessionTasks/EXTaskHandlersManager.h +21 -0
  77. package/ios/EXSessionTasks/EXTaskHandlersManager.m +56 -0
  78. package/ios/Encoding.swift +88 -0
  79. package/ios/ExpoFileSystem.h +1 -0
  80. package/ios/ExpoFileSystem.podspec +32 -0
  81. package/ios/FileSystemBackgroundSessionHandler.swift +25 -0
  82. package/ios/FileSystemExceptions.swift +69 -0
  83. package/ios/FileSystemHelpers.swift +66 -0
  84. package/ios/FileSystemModule.swift +263 -0
  85. package/ios/FileSystemRecords.swift +74 -0
  86. package/ios/NSData+EXFileSystem.h +9 -0
  87. package/ios/NSData+EXFileSystem.m +19 -0
  88. package/ios/NetworkingHelpers.swift +84 -0
  89. package/ios/Tests/EXFileSystemSpec.swift +55 -0
  90. package/jest.config.js +3 -0
  91. package/kepler/ExponentFileSystem.cpp +498 -0
  92. package/kepler/ExponentFileSystem.h +60 -0
  93. package/kepler/KeplerInit.cpp +28 -0
  94. package/kepler/NetworkingRequestHandler.cpp +47 -0
  95. package/kepler/test/FileSystem.cpp +425 -0
  96. package/package.json +1 -0
  97. package/plugin/build/withFileSystem.d.ts +3 -0
  98. package/plugin/build/withFileSystem.js +12 -0
  99. package/plugin/src/withFileSystem.ts +13 -0
  100. package/plugin/tsconfig.json +9 -0
  101. package/plugin/tsconfig.tsbuildinfo +1 -0
  102. package/react-native.config.js +21 -0
  103. package/src/ExponentFileSystem.kepler.ts +167 -0
  104. package/src/ExponentFileSystem.ts +7 -0
  105. package/src/ExponentFileSystem.web.ts +2 -0
  106. package/src/ExponentFileSystemShim.ts +23 -0
  107. package/src/FileSystem.ts +756 -0
  108. package/src/FileSystem.types.ts +339 -0
  109. package/src/index.ts +2 -0
  110. package/src/types.ts +34 -0
  111. package/tsconfig.json +9 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,2 @@
1
+ // @generated by expo-module-scripts
2
+ module.exports = require('expo-module-scripts/eslintrc.base.js');
package/CHANGELOG.md ADDED
@@ -0,0 +1,317 @@
1
+ # Changelog
2
+
3
+ ## Unpublished
4
+
5
+ ### 🛠 Breaking changes
6
+
7
+ ### 🎉 New features
8
+
9
+ ### 🐛 Bug fixes
10
+
11
+ ### 💡 Others
12
+
13
+ ## 15.8.0 — 2023-10-17
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - On `Android`, use `addInterceptor` instead of `addNetworkInterceptor` in `downloadResumableStartAsync`. ([#24702](https://github.com/expo/expo/pull/24702) by [@alanhughes](https://github.com/alanjhughes))
22
+
23
+ ## 15.7.0 — 2023-09-15
24
+
25
+ ### 🎉 New features
26
+
27
+ - Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
28
+
29
+ ### 💡 Others
30
+
31
+ - Migrated to Swift and Expo Modules API on iOS. ([#23943](https://github.com/expo/expo/pull/23943) by [@tsapeta](https://github.com/tsapeta))
32
+ - Throw the correct error when we can't find the permissions modules. ([#24464](https://github.com/expo/expo/pull/24464) by [@alanhughes](https://github.com/alanjhughes))
33
+
34
+ ## 15.6.0 — 2023-09-04
35
+
36
+ ### 🎉 New features
37
+
38
+ - Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
39
+
40
+ ## 15.4.4 - 2023-08-29
41
+
42
+ _This version does not introduce any user-facing changes._
43
+
44
+ ## 15.4.3 - 2023-08-09
45
+
46
+ ### 🐛 Bug fixes
47
+
48
+ - Fix regression in `copyAsync` on Android. ([#23892](https://github.com/expo/expo/pull/23892) by [@brentvatne](https://github.com/brentvatne))
49
+
50
+ ## 15.5.1 — 2023-08-02
51
+
52
+ _This version does not introduce any user-facing changes._
53
+
54
+ ## 15.5.0 — 2023-07-28
55
+
56
+ ### 💡 Others
57
+
58
+ - Fork `uuid@3.4.0` and move into `expo-modules-core`. Remove the original dependency. ([#23249](https://github.com/expo/expo/pull/23249) by [@alanhughes](https://github.com/alanjhughes))
59
+
60
+ ## 15.4.2 — 2023-06-28
61
+
62
+ _This version does not introduce any user-facing changes._
63
+
64
+ ## 15.4.1 — 2023-06-27
65
+
66
+ ### 🐛 Bug fixes
67
+
68
+ - Fixed hard crash on iOS when calling readDirectoryAsync. ([#23106](https://github.com/expo/expo/pull/23106) by [@aleqsio](https://github.com/aleqsio))
69
+
70
+ ## 15.4.0 — 2023-06-13
71
+
72
+ ### 🎉 New features
73
+
74
+ - Migrated Android codebase to use Expo modules API. ([#22728](https://github.com/expo/expo/pull/22728) by [@alanhughes](https://github.com/alanjhughes))
75
+
76
+ ### 🐛 Bug fixes
77
+
78
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
79
+
80
+ ## 15.3.0 — 2023-05-08
81
+
82
+ ### 🛠 Breaking changes
83
+
84
+ - Removed the deprecated `UploadProgressData.totalByteSent` field. ([#22277](https://github.com/expo/expo/pull/22277) by [@gabrieldonadel](https://github.com/gabrieldonadel))
85
+
86
+ ### 🐛 Bug fixes
87
+
88
+ - Add UTF-8 URI support on iOS. ([#21196](https://github.com/expo/expo/pull/21196) by [@gabrieldonadel](https://github.com/gabrieldonadel))
89
+
90
+ ### 💡 Others
91
+
92
+ - Android: Switch from deprecated `toLowerCase` to `lowercase` function ([#22225](https://github.com/expo/expo/pull/22225) by [@hbiede](https://github.com/hbiede))
93
+
94
+ ## 15.2.2 — 2023-02-09
95
+
96
+ _This version does not introduce any user-facing changes._
97
+
98
+ ## 15.2.1 — 2023-02-09
99
+
100
+ ### 🐛 Bug fixes
101
+
102
+ - Add utf-8 uri support on iOS. ([#21098](https://github.com/expo/expo/pull/21098) by [@gabrieldonadel](https://github.com/gabrieldonadel))
103
+
104
+ ## 15.2.0 — 2023-02-03
105
+
106
+ ### 💡 Others
107
+
108
+ - Extract nested object definitions to the separate types, which adds: `DeletingOptions`, `InfoOptions`, `RelocatingOptions` and `MakeDirectoryOptions` types. ([#20103](https://github.com/expo/expo/pull/20103) by [@Simek](https://github.com/Simek))
109
+ - Simplify the way in which types are exported from the package. ([#20103](https://github.com/expo/expo/pull/20103) by [@Simek](https://github.com/Simek))
110
+ - Rename `UploadProgressData` `totalByteSent` field to `totalBytesSent`. ([#20804](https://github.com/expo/expo/pull/20804) by [@gabrieldonadel](https://github.com/gabrieldonadel))
111
+ - On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
112
+
113
+ ## 15.1.1 — 2022-10-28
114
+
115
+ _This version does not introduce any user-facing changes._
116
+
117
+ ## 15.1.0 — 2022-10-25
118
+
119
+ ### 🎉 New features
120
+
121
+ - Added `DirectoriesModule` to expo-file-system on Android as a temporary solution to fix cache directories being incorrect in new Sweet API modules. ([#19205](https://github.com/expo/expo/pull/19205) by [@aleqsio](https://github.com/aleqsio))
122
+
123
+ ## 15.0.0 — 2022-10-06
124
+
125
+ ### 🛠 Breaking changes
126
+
127
+ - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
128
+
129
+ ### 💡 Others
130
+
131
+ - [plugin] Migrate import from @expo/config-plugins to expo/config-plugins and @expo/config-types to expo/config. ([#18855](https://github.com/expo/expo/pull/18855) by [@brentvatne](https://github.com/brentvatne))
132
+ - Drop `@expo/config-plugins` dependency in favor of peer dependency on `expo`. ([#18595](https://github.com/expo/expo/pull/18595) by [@EvanBacon](https://github.com/EvanBacon))
133
+
134
+ ## 14.1.0 — 2022-07-07
135
+
136
+ _This version does not introduce any user-facing changes._
137
+
138
+ ## 14.0.0 — 2022-04-18
139
+
140
+ ### 🛠 Breaking changes
141
+
142
+ - Remove okhttp and okio backward compatible workaround and drop react-native 0.64 support. ([#16446](https://github.com/expo/expo/pull/16446) by [@kudo](https://github.com/kudo))
143
+
144
+ ### 🐛 Bug fixes
145
+
146
+ - Fixed failing download on Android when using `createDownloadResumable()`, because of an invalid Range header. ([#15934](https://github.com/expo/expo/pull/15934) by [@johanpoirier](https://github.com/johanpoirier))
147
+ - Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
148
+ - Fix URL scheme differences between iOS and Android. ([#16352](https://github.com/expo/expo/pull/16352) by [@hbiede](https://github.com/hbiede))
149
+
150
+ ### ⚠️ Notices
151
+
152
+ - On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
153
+
154
+ ## 13.2.1 — 2022-01-20
155
+
156
+ ### 🐛 Bug fixes
157
+
158
+ - Fix build errors on React Native 0.66 caused by `okio` and `okhttp`. ([#15632](https://github.com/expo/expo/pull/15632) by [@kudo](https://github.com/kudo))
159
+
160
+ ## 13.2.0 — 2021-12-22
161
+
162
+ ### 🐛 Bug fixes
163
+
164
+ - Fixed runtime crash due to `.toUpperCase` not being invoked as a function, it was missing `()`. ([#15615](https://github.com/expo/expo/pull/15615) by [@lukebrandonfarrell](https://github.com/lukebrandonfarrell))
165
+ - Fixed `totalByteSent` in upload progress callback incorrectly sending `bytesSent` on iOS. ([#15615](https://github.com/expo/expo/pull/15615) by [@lukebrandonfarrell](https://github.com/lukebrandonfarrell))
166
+ - Fixed simulator runtime crash on arm64 devices caused by `CFRelease(NULL)`. ([#15496](https://github.com/expo/expo/pull/15496) by [@daxaxelrod](https://github.com/daxaxelrod))
167
+
168
+ ### 💡 Others
169
+
170
+ - Updated `@expo/config-plugins` from `4.0.2` to `4.0.14` ([#15621](https://github.com/expo/expo/pull/15621) by [@EvanBacon](https://github.com/EvanBacon))
171
+
172
+ ## 13.1.4 — 2022-02-10
173
+
174
+ _This version does not introduce any user-facing changes._
175
+
176
+ ## 13.1.3 — 2022-02-01
177
+
178
+ ### 🐛 Bug fixes
179
+
180
+ - Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
181
+
182
+ ## 13.1.2 — 2022-01-22
183
+
184
+ ### 🐛 Bug fixes
185
+
186
+ - Fixed runtime crash due to `.toUpperCase` not being invoked as a function, it was missing `()`. ([#15615](https://github.com/expo/expo/pull/15615) by [@lukebrandonfarrell](https://github.com/lukebrandonfarrell))
187
+ - Fixed `totalByteSent` in upload progress callback incorrectly sending `bytesSent` on iOS. ([#15615](https://github.com/expo/expo/pull/15615) by [@lukebrandonfarrell](https://github.com/lukebrandonfarrell))
188
+ - Fixed simulator runtime crash on arm64 devices caused by `CFRelease(NULL)`. ([#15496](https://github.com/expo/expo/pull/15496) by [@daxaxelrod](https://github.com/daxaxelrod))
189
+
190
+ ## 13.1.1 — 2022-01-20
191
+
192
+ ### 🐛 Bug fixes
193
+
194
+ - Fix build errors on React Native 0.66 caused by `okio` and `okhttp`. ([#15632](https://github.com/expo/expo/pull/15632) by [@kudo](https://github.com/kudo))
195
+
196
+ ## 13.1.0 — 2021-11-17
197
+
198
+ ### 🐛 Bug fixes
199
+
200
+ - Fixed `uploadAsync` failing to resolve when using `BINARY_CONTENT`. ([#14764](https://github.com/expo/expo/pull/14764) by [@cruzach](https://github.com/cruzach))
201
+ - Fix `okio` library build error for `react-native@0.65` or above. ([#14761](https://github.com/expo/expo/pull/14761) by [@kudo](https://github.com/kudo))
202
+
203
+ ## 13.0.1 — 2021-10-01
204
+
205
+ _This version does not introduce any user-facing changes._
206
+
207
+ ## 13.0.0 — 2021-09-28
208
+
209
+ ### 🛠 Breaking changes
210
+
211
+ - Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
212
+
213
+ ### 🐛 Bug fixes
214
+
215
+ - `getFreeDiskStorageAsync` now correctly reports free disk space on iOS. ([#14279](https://github.com/expo/expo/pull/14279) by [mickmaccallum](https://github.com/mickmaccallum))
216
+ - Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
217
+
218
+ ### 💡 Others
219
+
220
+ - Updated `@expo/config-plugins` ([#14443](https://github.com/expo/expo/pull/14443) by [@EvanBacon](https://github.com/EvanBacon))
221
+ - Rewritten module to Kotlin. ([#14549](https://github.com/expo/expo/pull/14549) by [@mstach60161](https://github.com/mstach60161))
222
+
223
+ ## 12.0.0 — 2021-09-08
224
+
225
+ ### 🛠 Breaking changes
226
+
227
+ - Added `AndroidManifest.xml` queries for intent handling. ([#13388](https://github.com/expo/expo/pull/13388) by [@EvanBacon](https://github.com/EvanBacon))
228
+
229
+ ### 💡 Others
230
+
231
+ - Migrated from `@unimodules/core` to `expo-modules-core`. ([#13749](https://github.com/expo/expo/pull/13749) by [@tsapeta](https://github.com/tsapeta))
232
+
233
+ ## 11.1.0 — 2021-06-16
234
+
235
+ ### 🐛 Bug fixes
236
+
237
+ - Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
238
+ - Fixed crash of file system when try to read cache dir file on android. ([#12716](https://github.com/expo/expo/pull/13232) by [@nomi9995](https://github.com/nomi9995))
239
+
240
+ ### 💡 Others
241
+
242
+ - Migrated from `unimodules-file-system-interface` to `expo-modules-core`.
243
+ - Build Android code using Java 8 to fix Android instrumented test build error. ([#12939](https://github.com/expo/expo/pull/12939) by [@kudo](https://github.com/kudo))
244
+ - Refactored uuid imports to v7 style. ([#13037](https://github.com/expo/expo/pull/13037) by [@giautm](https://github.com/giautm))
245
+
246
+ ## 11.0.2 — 2021-04-13
247
+
248
+ _This version does not introduce any user-facing changes._
249
+
250
+ ## 11.0.1 — 2021-04-09
251
+
252
+ _This version does not introduce any user-facing changes._
253
+
254
+ ## 11.0.0 — 2021-03-10
255
+
256
+ ### 🎉 New features
257
+
258
+ - Converted plugin to TypeScript. ([#11715](https://github.com/expo/expo/pull/11715) by [@EvanBacon](https://github.com/EvanBacon))
259
+ - Updated Android build configuration to target Android 11 (added support for Android SDK 30). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
260
+ - Added support for Storage Access Framework (**Android only**). ([#12032](https://github.com/expo/expo/pull/12032) by [@lukmccall](https://github.com/lukmccall))
261
+
262
+ ### 🐛 Bug fixes
263
+
264
+ - Fixed copying movies from assets not working on iOS. ([#11749](https://github.com/expo/expo/pull/11749) by [@lukmccall](https://github.com/lukmccall))
265
+ - Remove peerDependencies and unimodulePeerDependencies from Expo modules. ([#11980](https://github.com/expo/expo/pull/11980) by [@brentvatne](https://github.com/brentvatne))
266
+
267
+ ## 10.0.0 — 2021-01-15
268
+
269
+ ### ⚠️ Notices
270
+
271
+ - The package is now shipped with prebuilt binaries on iOS. You can read more about it on [expo.fyi/prebuilt-modules](https://expo.fyi/prebuilt-modules). ([#11224](https://github.com/expo/expo/pull/11224) by [@tsapeta](https://github.com/tsapeta))
272
+
273
+ ### 🛠 Breaking changes
274
+
275
+ - Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta))
276
+
277
+ ### 🎉 New features
278
+
279
+ - Created config plugins ([#11538](https://github.com/expo/expo/pull/11538) by [@EvanBacon](https://github.com/EvanBacon))
280
+
281
+ ## 9.3.0 — 2020-11-17
282
+
283
+ _This version does not introduce any user-facing changes._
284
+
285
+ ## 9.2.0 — 2020-08-18
286
+
287
+ ### 🐛 Bug fixes
288
+
289
+ - Added docs about Android permissions and removed old storage permission. ([#9447](https://github.com/expo/expo/pull/9447) by [@bycedric](https://github.com/bycedric))
290
+
291
+ ## 9.1.0 — 2020-07-27
292
+
293
+ ### 🐛 Bug fixes
294
+
295
+ - Fix background URL session completion handler not being called. ([#8599](https://github.com/expo/expo/pull/8599) by [@lukmccall](https://github.com/lukmccall))
296
+ - Fix compilation error on macOS Catalyst ([#9055](https://github.com/expo/expo/pull/9055) by [@andymatuschak](https://github.com/andymatuschak))
297
+ - Fixed `uploadAsync` native signature on Android. ([#9076](https://github.com/expo/expo/pull/9076) by [@lukmccall](https://github.com/lukmccall))
298
+ - Fixed `uploadAsync` throwing `Double cannot be cast to Integer` on Android. ([#9076](https://github.com/expo/expo/pull/9076) by [@lukmccall](https://github.com/lukmccall))
299
+ - Fixed `getInfo` returning incorrect size when provided path points to a folder. ([#9063](https://github.com/expo/expo/pull/9063) by [@lukmccall](https://github.com/lukmccall))
300
+ - Fixed `uploadAsync()` returning empty response on iOS. ([#9166](https://github.com/expo/expo/pull/9166) by [@barthap](https://github.com/barthap))
301
+
302
+ ## 9.0.1 — 2020-05-29
303
+
304
+ _This version does not introduce any user-facing changes._
305
+
306
+ ## 9.0.0 — 2020-05-27
307
+
308
+ ### 🛠 Breaking changes
309
+
310
+ - `FileSystem.downloadAsync` and `FileSystem.DownloadResumable` work by default when the app is in background too — they won't reject when the application is backgrounded. ([#7380](https://github.com/expo/expo/pull/7380) by [@lukmccall](https://github.com/lukmccall))
311
+ - `FileSystem.downloadAsync` and `FileSystem.DownloadResumable` will reject when invalid headers dictionary is provided. These methods accept only `Record<string, string>`. ([#7380](https://github.com/expo/expo/pull/7380) by [@lukmccall](https://github.com/lukmccall))
312
+ - `FileSystem.getContentUriAsync` now returns a string. ([#7192](https://github.com/expo/expo/pull/7192) by [@lukmccall](https://github.com/lukmccall))
313
+
314
+ ### 🎉 New features
315
+
316
+ - Add `FileSystem.uploadAsync` method. ([#7380](https://github.com/expo/expo/pull/7380) by [@lukmccall](https://github.com/lukmccall))
317
+ - Add ability to read Android `raw` and `drawable` resources in `FileSystem.getInfoAsync`, `FileSystem.readAsStringAsync`, and `FileSystem.copyAsync`. ([#8104](https://github.com/expo/expo/pull/8104) by [@esamelson](https://github.com/esamelson))
package/CMakeLists.txt ADDED
@@ -0,0 +1,52 @@
1
+ #
2
+ # Copyright 2023 Amazon.com, Inc. or its affiliates. All rights reserved.
3
+ #
4
+ # AMAZON PROPRIETARY/CONFIDENTIAL
5
+ #
6
+ # You may not use this file except in compliance with the terms and conditions
7
+ # set forth in the accompanying LICENSE.TXT file.
8
+ #
9
+ # THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
10
+ # DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
11
+ # IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
12
+ # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
13
+ #
14
+ set(PACKAGE_NAME "expo-file-system")
15
+ set(AUTO_LINK_PACKAGE_NAME "${PACKAGE_NAME}-${KEPLER_REACT_NATIVE_MAJOR_VERSION}")
16
+ set(SOURCES_KEPLER
17
+ kepler/ExponentFileSystem.cpp
18
+ )
19
+
20
+ find_package(OpenSSL REQUIRED)
21
+
22
+ add_library(${PACKAGE_NAME} STATIC ${SOURCES_KEPLER})
23
+
24
+ target_link_libraries(
25
+ ${PACKAGE_NAME}
26
+ PUBLIC
27
+ keplerui::keplerscript-${KEPLER_REACT_NATIVE_MAJOR_VERSION}
28
+ OpenSSL::SSL
29
+ )
30
+
31
+ add_library(${AUTO_LINK_PACKAGE_NAME} SHARED kepler/KeplerInit.cpp)
32
+
33
+ set_target_properties(${AUTO_LINK_PACKAGE_NAME} PROPERTIES SOVERSION ${KEPLER_REACT_NATIVE_MAJOR_VERSION}.${KEPLER_REACT_NATIVE_MINOR_VERSION})
34
+
35
+ target_link_libraries(
36
+ ${AUTO_LINK_PACKAGE_NAME}
37
+ PRIVATE
38
+ keplerui::keplerscript-${KEPLER_REACT_NATIVE_MAJOR_VERSION}
39
+ ${PACKAGE_NAME}
40
+ )
41
+
42
+ # Helps in checking undefined references
43
+ add_executable(${AUTO_LINK_PACKAGE_NAME}_exe kepler/KeplerInit.cpp)
44
+ target_link_libraries(${AUTO_LINK_PACKAGE_NAME}_exe
45
+ PRIVATE
46
+ ${AUTO_LINK_PACKAGE_NAME}
47
+ keplerui::keplerscript-${KEPLER_REACT_NATIVE_MAJOR_VERSION}
48
+ )
49
+
50
+ install(TARGETS ${AUTO_LINK_PACKAGE_NAME}
51
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
52
+ )
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
2
+
3
+ These materials are licensed as "Program Materials" under the Program Materials License Agreement (the "Agreement"). The Agreement is available at https://developer.amazon.com/support/legal/pml. See the Agreement for the specific terms and conditions of the Agreement. Capitalized terms not defined in this file have the meanings given to them in the Agreement.
4
+
5
+ If you do not agree to the above terms and conditions, you may not use any file in this package.
6
+
7
+ YOUR USE OF THE PROGRAM MATERIALS IN OR ASSOCIATED WITH THIS PACKAGE IS AT YOUR SOLE RISK. IN NO EVENT WILL AMAZON BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES (INCLUDING FOR ANY LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, OR COMPUTER FAILURE OR MALFUNCTION) ARISING FROM OR RELATING TO SUCH PROGRAM MATERIALS, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, EVEN IF AMAZON HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS AND DISCLAIMERS APPLY EXCEPT TO THE EXTENT PROHIBITED BY APPLICABLE LAW.
@@ -0,0 +1,260 @@
1
+ # @amazon-devices/expo-file-system
2
+
3
+ ## Getting Started
4
+
5
+ `@amazon-devices/expo-file-system` provides access to file system of the device. It is also capable of downloading and uploading files from network URLs.
6
+
7
+ ### Installation
8
+
9
+ 1. Add the JavaScript library dependency in the `package.json` file:
10
+ ```json
11
+ "dependencies": {
12
+ ...
13
+ "@amazon-devices/expo-file-system": "~2.0.0",
14
+ "expo": "~50.0.0",
15
+ ...
16
+ }
17
+ ```
18
+
19
+ 2. Reinstall dependencies using `npm install` command.
20
+
21
+ ## Usage Examples
22
+
23
+ Basic read-write operations:
24
+
25
+ ```js
26
+ import React, {useEffect, useState} from 'react';
27
+ import {Alert, Button, StyleSheet, Text, View} from 'react-native';
28
+ import * as FileSystem from '@amazon-devices/expo-file-system';
29
+
30
+ export const App = () => {
31
+ const [fileContent, setFileContent] = useState<string | null>(null);
32
+ const fileUri = FileSystem.documentDirectory + 'sample.txt';
33
+
34
+ useEffect(() => {
35
+ (async () => {
36
+ const fileInfo = await FileSystem.getInfoAsync(fileUri);
37
+ if (fileInfo.exists) {
38
+ const content = await FileSystem.readAsStringAsync(fileUri);
39
+ setFileContent(content);
40
+ } else {
41
+ setFileContent('File does not exist - you need to write to file');
42
+ }
43
+ })();
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps
45
+ }, []);
46
+
47
+ const writeFile = async () => {
48
+ try {
49
+ await FileSystem.writeAsStringAsync(fileUri, 'Hello, file system!');
50
+ Alert.alert('File written successfully!');
51
+ } catch (error) {
52
+ console.error('Error writing the file:', error);
53
+ }
54
+ };
55
+
56
+ const readFile = async () => {
57
+ try {
58
+ const content = await FileSystem.readAsStringAsync(fileUri);
59
+ setFileContent(content);
60
+ } catch (error) {
61
+ console.error('Error reading the file:', error);
62
+ }
63
+ };
64
+
65
+ return (
66
+ <View style={styles.container}>
67
+ <Text style={styles.text}>File Content: {fileContent}</Text>
68
+ <Button title="Write to File" onPress={writeFile} />
69
+ <Button title="Read from File" onPress={readFile} />
70
+ </View>
71
+ );
72
+ };
73
+
74
+ const styles = StyleSheet.create({
75
+ container: {
76
+ flex: 1,
77
+ justifyContent: 'center',
78
+ alignItems: 'center',
79
+ backgroundColor: 'white',
80
+ },
81
+ text: {
82
+ fontSize: 30,
83
+ textAlign: 'center',
84
+ },
85
+ });
86
+
87
+
88
+ ```
89
+
90
+ Download/upload file
91
+
92
+ ```js
93
+ import * as FileSystem from '@amazon-devices/expo-file-system';
94
+ import {DownloadOptions, FileSystemUploadOptions} from '@amazon-devices/expo-file-system';
95
+ import React, {useState} from 'react';
96
+ import {Button, ScrollView, StyleSheet, Text, View} from 'react-native';
97
+
98
+ export const App = () => {
99
+ const downloadAsyncArgs: {
100
+ uri: string;
101
+ fileUri: string;
102
+ options: DownloadOptions;
103
+ } = {
104
+ uri: 'https://httpbin.org/get',
105
+ fileUri: FileSystem.documentDirectory + 'downloadResponse.json',
106
+ options: {
107
+ md5: true,
108
+ cache: false,
109
+ headers: {
110
+ Accept: 'application/json',
111
+ },
112
+ },
113
+ };
114
+ const uploadAsyncArgs: {
115
+ url: string;
116
+ fileUri: string;
117
+ options: FileSystemUploadOptions;
118
+ } = {
119
+ url: 'https://httpbin.org/patch',
120
+ fileUri: FileSystem.documentDirectory + 'downloadResponse.json',
121
+ options: {
122
+ fieldName: 'data',
123
+ httpMethod: 'PATCH',
124
+ uploadType: FileSystem.FileSystemUploadType.BINARY_CONTENT,
125
+ headers: {
126
+ Accept: 'application/json',
127
+ },
128
+ },
129
+ };
130
+
131
+ const [downloadResponse, setDownloadResponse] =
132
+ useState<FileSystem.FileSystemDownloadResult>();
133
+ const [uploadResponse, setUploadResponse] =
134
+ useState<FileSystem.FileSystemUploadResult>();
135
+
136
+ const handleDownloadAsync = async () => {
137
+ const {uri, fileUri, options} = downloadAsyncArgs;
138
+ FileSystem.downloadAsync(uri, fileUri, options)
139
+ .then(setDownloadResponse)
140
+ .catch((error) => setDownloadResponse(error.message));
141
+ };
142
+
143
+ const handleUploadAsync = async () => {
144
+ const {url, fileUri, options} = uploadAsyncArgs;
145
+ FileSystem.uploadAsync(url, fileUri, options)
146
+ .then(setUploadResponse)
147
+ .catch((error) => setUploadResponse(error.message));
148
+ };
149
+
150
+ return (
151
+ <ScrollView style={styles.container}>
152
+ <Button title="Download file" onPress={handleDownloadAsync} />
153
+ <View style={styles.cell}>
154
+ <Text style={styles.cellText}>
155
+ {JSON.stringify(downloadResponse, null, 2)}
156
+ </Text>
157
+ </View>
158
+
159
+ <Button title="Upload file" onPress={handleUploadAsync} />
160
+ <View style={styles.cell}>
161
+ <Text style={styles.cellText}>
162
+ {JSON.stringify(uploadResponse, null, 2)}
163
+ </Text>
164
+ </View>
165
+ </ScrollView>
166
+ );
167
+ };
168
+
169
+ const styles = StyleSheet.create({
170
+ container: {
171
+ flex: 1,
172
+ padding: 20,
173
+ backgroundColor: 'white',
174
+ },
175
+ cell: {
176
+ flex: 1,
177
+ padding: 10,
178
+ borderWidth: 2,
179
+ justifyContent: 'center',
180
+ borderColor: 'white',
181
+ },
182
+ cellText: {
183
+ fontSize: 24,
184
+ color: 'black',
185
+ },
186
+ });
187
+
188
+
189
+ ```
190
+
191
+ ## API Reference
192
+
193
+ Check out the documentation page for info about this library, API reference and more [Official Expo documentation for expo-file-system](https://github.com/expo/expo/blob/sdk-49/docs/pages/versions/v49.0.0/sdk/filesystem.mdx).
194
+
195
+ ### Constants
196
+
197
+ | Constant | Description | platform support |
198
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------- |
199
+ | documentDirectory | URI pointing to the directory where user documents for this app will be stored. E.g. `/data/` | All |
200
+ | cacheDirectory | URI pointing to the directory where temporary files used by this app will be stored. E.g. `/cache/` | All |
201
+ | bundleDirectory | URI to the directory where assets bundled with the application are stored. E.g. `/pkg/bundle/index.hermes.bundle` | All |
202
+
203
+ ### Classes
204
+
205
+ | Class | Platform support |
206
+ | -------------------------------- | ---------------- |
207
+ | DownloadResumable | Android, iOS |
208
+ | FileSystemCancellableNetworkTask | Android, iOS |
209
+ | UploadTask | Android, iOS |
210
+
211
+ ### Methods
212
+
213
+ | Method | Description | Platform support |
214
+ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
215
+ | copyAsync | Create a copy of a file or directory | All |
216
+ | createDownloadResumable | Create a `DownloadResumable` object which can start, pause, and resume a download of contents at a remote URI to a file in the app's file system | Android, iOS |
217
+ | createUploadTask | | Android, iOS |
218
+ | deleteAsync | Delete a file or directory | All |
219
+ | deleteLegacyDocumentDirectoryAndroid | | All |
220
+ | downloadAsync | Download the contents at a remote URI to a file in the app's file system | All |
221
+ | getContentUriAsync | Takes a `file://` URI and converts it into content URI (`content://`) so that it can be accessed by other applications outside of Expo | Android, Kepler |
222
+ | getFreeDiskStorageAsync | Gets the available internal disk storage size, in bytes | All |
223
+ | getInfoAsync | Get metadata information about a file, directory or external content/asset | All |
224
+ | getTotalDiskCapacityAsync | Gets total internal disk storage size, in bytes | All |
225
+ | makeDirectoryAsync | Create a new empty directory | All |
226
+ | moveAsync | Move a file or directory to a new location | All |
227
+ | readAsStringAsync | Read the entire contents of a file as a string | All |
228
+ | readDirectoryAsync | Enumerate the contents of a directory | All |
229
+ | uploadAsync | Upload the contents of the file pointed by `fileUri` to the remote url | All |
230
+ | writeAsStringAsync | Write the entire contents of a file as a string | All |
231
+
232
+ ### Supported URI schemes
233
+
234
+ In this table, you can see what type of URI can be handled by each method.
235
+
236
+ | Method name | Android | iOS | Kepler |
237
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
238
+ | `getInfoAsync` | `file:///`,<br/>`content://`,<br/>`asset://`,<br/>no scheme | `file://`,<br/>`ph://`,<br/>`assets-library://` | no scheme eg. `/data/file.txt` |
239
+ | `readAsStringAsync` | `file:///`,<br/>`asset://`,<br/>SAF URI | `file://` | no scheme |
240
+ | `writeAsStringAsync` | `file:///`,<br/>SAF URI | `file://` | no scheme |
241
+ | `deleteAsync` | `file:///`,<br/>SAF URI | `file://` | no scheme |
242
+ | `moveAsync` | Source:<br/>`file:///`,<br/>SAF URI<br/><br/>Destination:<br/>`file://` | Source:<br/>`file://`<br/><br/>Destination:<br/>`file://` | Source:<br/>no scheme <br/><br/>Destination:<br/>no scheme |
243
+ | `copyAsync` | Source:<br/>`file:///`,<br/>`content://`,<br/>`asset://`,<br/>SAF URI,<br/>no scheme<br/><br/>Destination:<br/>`file://` | Source:<br/>`file://`,<br/>`ph://`,<br/>`assets-library://`<br/><br/>Destination:<br/>`file://` | Source:<br/>no scheme <br/><br/>Destination:<br/>no scheme |
244
+ | `makeDirectoryAsync` | `file:///` | `file://` | no scheme |
245
+ | `readDirectoryAsync` | `file:///` | `file://` | no scheme |
246
+ | `downloadAsync` | Source:<br/>`http://`,<br/>`https://`<br/><br/>Destination:<br/>`file:///` | Source:<br/>`http://`,<br/>`https://`<br/><br/>Destination:<br/>`file://` | Source:<br/>`http://`,<br/>`https://`<br/><br/>Destination:<br/>no scheme |
247
+ | `uploadAsync` | Source:<br/>`file:///`<br/><br/>Destination:<br/>`http://`<br/>`https://` | Source:<br/>`file://`<br/><br/>Destination:<br/>`http://`<br/>`https://` | Source:<br/>no scheme<br/><br/>Destination:<br/>`http://`<br/>`https://` |
248
+ | `createDownloadResumable` | Source:<br/>`http://`,<br/>`https://`<br/><br/>Destination:<br/>`file:///` | Source:<br/>`http://`,<br/>`https://`<br/><br/>Destination:<br/>`file://` | Source:<br/>`http://`,<br/>`https://`<br/><br/>Destination:<br/>no scheme |
249
+
250
+ > On Android **no scheme** defaults to a bundled resource.
251
+
252
+ ## Known Issues
253
+
254
+ * On Kepler `getTotalDiskCapacityAsync` always returns `0`
255
+
256
+ ## Supported Versions
257
+
258
+ | Package version | Based on | @amazon-devices/react-native-kepler version |
259
+ | ---------------- | -------- | --------------------------------- |
260
+ | 2.0.x | expo-file-system v15.8.0 | 2.0.x |