expo-file-system 19.0.7 → 19.0.9

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 (63) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +11 -5
  4. package/android/src/main/java/expo/modules/filesystem/legacy/FileSystemLegacyModule.kt +11 -5
  5. package/build/ExpoFileSystem.types.d.ts +4 -5
  6. package/build/ExpoFileSystem.types.d.ts.map +1 -1
  7. package/build/index.d.ts +1 -0
  8. package/build/index.d.ts.map +1 -1
  9. package/build/legacyWarnings.d.ts +66 -0
  10. package/build/legacyWarnings.d.ts.map +1 -0
  11. package/expo-module.config.json +1 -1
  12. package/ios/FilePickingHandler.swift +88 -0
  13. package/ios/FilePickingUtils.swift +134 -0
  14. package/ios/FileSystemExceptions.swift +24 -0
  15. package/ios/FileSystemModule.swift +32 -7
  16. package/ios/Legacy/FileSystemLegacyModule.swift +10 -6
  17. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.7/expo.modules.filesystem-19.0.7-sources.jar → 19.0.9/expo.modules.filesystem-19.0.9-sources.jar} +0 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9-sources.jar.md5 +1 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9-sources.jar.sha1 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9-sources.jar.sha256 +1 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9-sources.jar.sha512 +1 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.aar +0 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.aar.md5 +1 -0
  24. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.aar.sha1 +1 -0
  25. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.aar.sha256 +1 -0
  26. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.aar.sha512 +1 -0
  27. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.7/expo.modules.filesystem-19.0.7.module → 19.0.9/expo.modules.filesystem-19.0.9.module} +22 -22
  28. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.module.md5 +1 -0
  29. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.module.sha1 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.module.sha256 +1 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.module.sha512 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.7/expo.modules.filesystem-19.0.7.pom → 19.0.9/expo.modules.filesystem-19.0.9.pom} +1 -1
  33. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.pom.md5 +1 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.pom.sha1 +1 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.pom.sha256 +1 -0
  36. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.9/expo.modules.filesystem-19.0.9.pom.sha512 +1 -0
  37. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml +4 -4
  38. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.md5 +1 -1
  39. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha1 +1 -1
  40. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256 +1 -1
  41. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512 +1 -1
  42. package/next.ts +1 -0
  43. package/package.json +4 -4
  44. package/src/ExpoFileSystem.types.ts +4 -5
  45. package/src/index.ts +2 -0
  46. package/src/legacyWarnings.ts +163 -0
  47. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.md5 +0 -1
  48. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.sha1 +0 -1
  49. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.sha256 +0 -1
  50. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.sha512 +0 -1
  51. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar +0 -0
  52. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.md5 +0 -1
  53. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.sha1 +0 -1
  54. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.sha256 +0 -1
  55. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.sha512 +0 -1
  56. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.md5 +0 -1
  57. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.sha1 +0 -1
  58. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.sha256 +0 -1
  59. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.sha512 +0 -1
  60. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.md5 +0 -1
  61. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.sha1 +0 -1
  62. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.sha256 +0 -1
  63. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 19.0.9 — 2025-09-03
14
+
15
+ ### 🎉 New features
16
+
17
+ - Add stubs for legacy methods imported from "expo-file-system". ([#39244](https://github.com/expo/expo/pull/39244) by [@aleqsio](https://github.com/aleqsio))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - [iOS] Fix tvOS compile error. ([#39345](https://github.com/expo/expo/pull/39345) by [@douglowder](https://github.com/douglowder))
22
+
23
+ ## 19.0.8 — 2025-09-02
24
+
25
+ ### 🎉 New features
26
+
27
+ - [iOS] Add `pickFileAsync` support ([#39173](https://github.com/expo/expo/pull/39173) by [@kosmydel](https://github.com/kosmydel))
28
+
13
29
  ## 19.0.7 — 2025-08-31
14
30
 
15
31
  ### 🎉 New features
@@ -44,6 +60,7 @@ _This version does not introduce any user-facing changes._
44
60
  ### 💡 Others
45
61
 
46
62
  - Update typings for `typescript@5.9` ([#38833](https://github.com/expo/expo/pull/38833) by [@kitten](https://github.com/kitten))
63
+ - Change Constants to Constant/Property. ([#38926](https://github.com/expo/expo/pull/38926) by [@jakex7](https://github.com/jakex7))
47
64
 
48
65
  ## 19.0.0 — 2025-08-13
49
66
 
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '19.0.7'
7
+ version = '19.0.9'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.filesystem"
11
11
  defaultConfig {
12
12
  versionCode 30
13
- versionName "19.0.7"
13
+ versionName "19.0.9"
14
14
  }
15
15
  }
16
16
 
@@ -28,11 +28,17 @@ class FileSystemModule : Module() {
28
28
  override fun definition() = ModuleDefinition {
29
29
  Name("FileSystem")
30
30
 
31
- Constants(
32
- "documentDirectory" to Uri.fromFile(context.filesDir).toString() + "/",
33
- "cacheDirectory" to Uri.fromFile(context.cacheDir).toString() + "/",
34
- "bundleDirectory" to "asset://"
35
- )
31
+ Constant("documentDirectory") {
32
+ Uri.fromFile(context.filesDir).toString() + "/"
33
+ }
34
+
35
+ Constant("cacheDirectory") {
36
+ Uri.fromFile(context.cacheDir).toString() + "/"
37
+ }
38
+
39
+ Constant("bundleDirectory") {
40
+ "asset://"
41
+ }
36
42
 
37
43
  Property("totalDiskSpace") {
38
44
  File(context.filesDir.path).totalSpace
@@ -89,11 +89,17 @@ open class FileSystemLegacyModule : Module() {
89
89
  override fun definition() = ModuleDefinition {
90
90
  Name("ExponentFileSystem")
91
91
 
92
- Constants(
93
- "documentDirectory" to Uri.fromFile(context.filesDir).toString() + "/",
94
- "cacheDirectory" to Uri.fromFile(context.cacheDir).toString() + "/",
95
- "bundleDirectory" to "asset:///"
96
- )
92
+ Constant("documentDirectory") {
93
+ Uri.fromFile(context.filesDir).toString() + "/"
94
+ }
95
+
96
+ Constant("cacheDirectory") {
97
+ Uri.fromFile(context.cacheDir).toString() + "/"
98
+ }
99
+
100
+ Constant("bundleDirectory") {
101
+ "asset:///"
102
+ }
97
103
 
98
104
  Events(
99
105
  EXDownloadProgressEventName,
@@ -231,16 +231,15 @@ export declare class File {
231
231
  */
232
232
  static downloadFileAsync(url: string, destination: Directory | File, options?: DownloadOptions): Promise<File>;
233
233
  /**
234
- * A static method that opens a file picker to select a single file of specified type.
234
+ * A static method that opens a file picker to select a single file of specified type. On iOS, it returns a temporary copy of the file leaving the original file untouched.
235
235
  *
236
- * @platform android
236
+ * Selecting multiple files is not supported yet.
237
237
  *
238
238
  * @param initialUri An optional URI pointing to an initial folder on which the file picker is opened.
239
239
  * @param mimeType A mime type that is used to filter out files that can be picked out.
240
- * @returns a `File` instance.
241
- * @platform android
240
+ * @returns a `File` instance or an array of `File` instances.
242
241
  */
243
- static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File>;
242
+ static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File | File[]>;
244
243
  /**
245
244
  * A size of the file in bytes. 0 if the file does not exist, or it cannot be read.
246
245
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFileSystem.types.d.ts","sourceRoot":"","sources":["../src/ExpoFileSystem.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;;;OAOG;gBACS,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE;IAElD;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,IAAI,IAAI;IAEpB;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAEd;;OAEG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;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC"}
package/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './FileSystem';
2
2
  export { type FileCreateOptions, type DirectoryCreateOptions, type FileHandle, type FileInfo, type InfoOptions, type PathInfo, type DirectoryInfo, } from './ExpoFileSystem.types';
3
+ export * from './legacyWarnings';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,GACnB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,GACnB,MAAM,wBAAwB,CAAC;AAEhC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { DownloadOptions, FileSystemNetworkTaskProgressCallback, DownloadProgressData, UploadProgressData, FileInfo, FileSystemDownloadResult, FileSystemUploadOptions, FileSystemUploadResult, ReadingOptions, WritingOptions, DeletingOptions, InfoOptions, RelocatingOptions, MakeDirectoryOptions } from './legacy/FileSystem.types';
2
+ /**
3
+ * @deprecated Use `new File().info` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
4
+ */
5
+ export declare function getInfoAsync(fileUri: string, options?: InfoOptions): Promise<FileInfo>;
6
+ /**
7
+ * @deprecated Use `new File().text()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
8
+ */
9
+ export declare function readAsStringAsync(fileUri: string, options?: ReadingOptions): Promise<string>;
10
+ /**
11
+ * @deprecated Import this method from `expo-file-system/legacy`. This method will throw in runtime.
12
+ */
13
+ export declare function getContentUriAsync(fileUri: string): Promise<string>;
14
+ /**
15
+ * @deprecated Use `new File().write()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
16
+ */
17
+ export declare function writeAsStringAsync(fileUri: string, contents: string, options?: WritingOptions): Promise<void>;
18
+ /**
19
+ * @deprecated Use `new File().delete()` or `new Directory().delete()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
20
+ */
21
+ export declare function deleteAsync(fileUri: string, options?: DeletingOptions): Promise<void>;
22
+ /**
23
+ * @deprecated
24
+ */
25
+ export declare function deleteLegacyDocumentDirectoryAndroid(): Promise<void>;
26
+ /**
27
+ * @deprecated Use `new File().move()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
28
+ */
29
+ export declare function moveAsync(options: RelocatingOptions): Promise<void>;
30
+ /**
31
+ * @deprecated Use `new File().copy()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
32
+ */
33
+ export declare function copyAsync(options: RelocatingOptions): Promise<void>;
34
+ /**
35
+ * @deprecated Use `new Directory().create()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
36
+ */
37
+ export declare function makeDirectoryAsync(fileUri: string, options?: MakeDirectoryOptions): Promise<void>;
38
+ /**
39
+ * @deprecated Use `new Directory().list()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
40
+ */
41
+ export declare function readDirectoryAsync(fileUri: string): Promise<string[]>;
42
+ /**
43
+ * @deprecated Use `Paths.availableDiskSpace` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
44
+ */
45
+ export declare function getFreeDiskStorageAsync(): Promise<number>;
46
+ /**
47
+ * @deprecated Use `Paths.totalDiskSpace` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
48
+ */
49
+ export declare function getTotalDiskCapacityAsync(): Promise<number>;
50
+ /**
51
+ * @deprecated Use `File.downloadFileAsync` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
52
+ */
53
+ export declare function downloadAsync(uri: string, fileUri: string, options?: DownloadOptions): Promise<FileSystemDownloadResult>;
54
+ /**
55
+ * @deprecated Use `@expo/fetch` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
56
+ */
57
+ export declare function uploadAsync(url: string, fileUri: string, options?: FileSystemUploadOptions): Promise<FileSystemUploadResult>;
58
+ /**
59
+ * @deprecated Import this method from `expo-file-system/legacy`. This method will throw in runtime.
60
+ */
61
+ export declare function createDownloadResumable(uri: string, fileUri: string, options?: DownloadOptions, callback?: FileSystemNetworkTaskProgressCallback<DownloadProgressData>, resumeData?: string): any;
62
+ /**
63
+ * @deprecated Import this method from `expo-file-system/legacy`. This method will throw in runtime.
64
+ */
65
+ export declare function createUploadTask(url: string, fileUri: string, options?: FileSystemUploadOptions, callback?: FileSystemNetworkTaskProgressCallback<UploadProgressData>): any;
66
+ //# sourceMappingURL=legacyWarnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacyWarnings.d.ts","sourceRoot":"","sources":["../src/legacyWarnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,qCAAqC,EACrC,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAQnC;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEhG;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/F;AAED;;GAEG;AACH,wBAAsB,oCAAoC,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1E;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,C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"artifactId": "expo.modules.filesystem",
15
- "version": "19.0.7",
15
+ "version": "19.0.9",
16
16
  "repository": "local-maven-repo"
17
17
  }
18
18
  }
@@ -0,0 +1,88 @@
1
+ // UIKit is unavailable on macOS, so platform checks are necessary.
2
+ // For macOS support, we should consider using NSOpenPanel: https://developer.apple.com/documentation/appkit/nsopenpanel
3
+ // UIDocumentPickerViewController is unavailable on tvOS
4
+ #if os(iOS)
5
+ import ExpoModulesCore
6
+ import UIKit
7
+
8
+ internal class FilePickingHandler: FilePickingResultHandler {
9
+ private weak var module: FileSystemModule?
10
+ internal var filePickingContext: FilePickingContext?
11
+
12
+ init(module: FileSystemModule) {
13
+ self.module = module
14
+ }
15
+
16
+ func presentDocumentPicker(
17
+ picker: UIDocumentPickerViewController,
18
+ isDirectory: Bool,
19
+ initialUri: URL?,
20
+ mimeType: String?,
21
+ promise: Promise
22
+ ) {
23
+ guard let module = module else {
24
+ promise.reject(MissingViewControllerException())
25
+ return
26
+ }
27
+
28
+ if filePickingContext != nil {
29
+ promise.reject(PickingInProgressException())
30
+ return
31
+ }
32
+
33
+ guard let currentVc = module.appContext?.utilities?.currentViewController() else {
34
+ promise.reject(MissingViewControllerException())
35
+ return
36
+ }
37
+
38
+ let pickerDelegate = FilePickingDelegate(resultHandler: self, isDirectory: isDirectory)
39
+ filePickingContext = FilePickingContext(
40
+ promise: promise,
41
+ initialUri: initialUri,
42
+ mimeType: mimeType,
43
+ isDirectory: isDirectory,
44
+ delegate: pickerDelegate
45
+ )
46
+
47
+ picker.delegate = pickerDelegate
48
+ picker.presentationController?.delegate = pickerDelegate
49
+ picker.allowsMultipleSelection = false
50
+
51
+ if UIDevice.current.userInterfaceIdiom == .pad {
52
+ let viewFrame = currentVc.view.frame
53
+ picker.popoverPresentationController?.sourceRect = CGRect(
54
+ x: viewFrame.midX,
55
+ y: viewFrame.maxY,
56
+ width: 0,
57
+ height: 0
58
+ )
59
+ picker.popoverPresentationController?.sourceView = currentVc.view
60
+ picker.modalPresentationStyle = .pageSheet
61
+ }
62
+
63
+ currentVc.present(picker, animated: true)
64
+ }
65
+
66
+ func didPickFileAt(url: URL) {
67
+ handlePickingResult { context in
68
+ let file = FileSystemFile(url: url)
69
+ context.promise.resolve(file)
70
+ }
71
+ }
72
+
73
+ func didCancelPicking() {
74
+ handlePickingResult { context in
75
+ context.promise.reject(FilePickingCancelledException())
76
+ }
77
+ }
78
+
79
+ private func handlePickingResult(_ handler: (FilePickingContext) -> Void) {
80
+ guard let context = filePickingContext else {
81
+ return
82
+ }
83
+ filePickingContext = nil
84
+
85
+ handler(context)
86
+ }
87
+ }
88
+ #endif
@@ -0,0 +1,134 @@
1
+ // UIDocumentPickerViewController is unavailable on tvOS
2
+ #if os(iOS)
3
+ import ExpoModulesCore
4
+ import MobileCoreServices
5
+ import UIKit
6
+ import UniformTypeIdentifiers
7
+
8
+ internal protocol FilePickingResultHandler {
9
+ func didPickFileAt(url: URL)
10
+ func didCancelPicking()
11
+ }
12
+
13
+ internal struct FilePickingContext {
14
+ let promise: Promise
15
+ let initialUri: URL?
16
+ let mimeType: String?
17
+ let isDirectory: Bool
18
+ let delegate: FilePickingDelegate
19
+ var pickedUrl: URL?
20
+ }
21
+
22
+ internal class FilePickingDelegate: NSObject, UIDocumentPickerDelegate, UIAdaptivePresentationControllerDelegate {
23
+ private let resultHandler: FilePickingResultHandler
24
+ private let isDirectory: Bool
25
+ private weak var pickingHandler: FilePickingHandler?
26
+
27
+ init(resultHandler: FilePickingResultHandler, isDirectory: Bool = false) {
28
+ self.resultHandler = resultHandler
29
+ self.isDirectory = isDirectory
30
+ self.pickingHandler = resultHandler as? FilePickingHandler
31
+ }
32
+
33
+ func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
34
+ guard let url = urls.first else {
35
+ self.resultHandler.didCancelPicking()
36
+ return
37
+ }
38
+
39
+ self.resultHandler.didPickFileAt(url: url)
40
+ }
41
+
42
+ func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
43
+ self.resultHandler.didCancelPicking()
44
+ }
45
+
46
+ func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
47
+ self.resultHandler.didCancelPicking()
48
+ }
49
+ }
50
+
51
+ internal func createFilePicker(initialUri: URL?, mimeType: String?) -> UIDocumentPickerViewController {
52
+ if #available(iOS 14.0, *) {
53
+ let utTypes: [UTType]
54
+ if let mimeType = mimeType {
55
+ if let utType = UTType(mimeType: mimeType) {
56
+ utTypes = [utType]
57
+ } else {
58
+ utTypes = [UTType.item]
59
+ }
60
+ } else {
61
+ utTypes = [UTType.item]
62
+ }
63
+
64
+ let picker = UIDocumentPickerViewController(forOpeningContentTypes: utTypes, asCopy: true)
65
+
66
+ if let initialUri = initialUri {
67
+ picker.directoryURL = initialUri
68
+ }
69
+
70
+ return picker
71
+ }
72
+
73
+ let utiTypes: [String]
74
+ if let mimeType = mimeType {
75
+ utiTypes = [toUTI(mimeType: mimeType)]
76
+ } else {
77
+ utiTypes = [kUTTypeItem as String]
78
+ }
79
+
80
+ let picker = UIDocumentPickerViewController(documentTypes: utiTypes, in: .import)
81
+
82
+ if let initialUri = initialUri {
83
+ picker.directoryURL = initialUri
84
+ }
85
+
86
+ return picker
87
+ }
88
+
89
+ @available(iOS 14.0, *)
90
+ private func toUTType(mimeType: String) -> UTType? {
91
+ switch mimeType {
92
+ case "*/*":
93
+ return UTType.item
94
+ case "image/*":
95
+ return UTType.image
96
+ case "video/*":
97
+ return UTType.movie
98
+ case "audio/*":
99
+ return UTType.audio
100
+ case "text/*":
101
+ return UTType.text
102
+ default:
103
+ return UTType(mimeType: mimeType)
104
+ }
105
+ }
106
+
107
+ private func toUTI(mimeType: String) -> String {
108
+ var uti: CFString
109
+
110
+ switch mimeType {
111
+ case "*/*":
112
+ uti = kUTTypeItem
113
+ case "image/*":
114
+ uti = kUTTypeImage
115
+ case "video/*":
116
+ uti = kUTTypeVideo
117
+ case "audio/*":
118
+ uti = kUTTypeAudio
119
+ case "text/*":
120
+ uti = kUTTypeText
121
+ default:
122
+ if let ref = UTTypeCreatePreferredIdentifierForTag(
123
+ kUTTagClassMIMEType,
124
+ mimeType as CFString,
125
+ nil
126
+ )?.takeRetainedValue() {
127
+ uti = ref
128
+ } else {
129
+ uti = kUTTypeItem
130
+ }
131
+ }
132
+ return uti as String
133
+ }
134
+ #endif
@@ -72,3 +72,27 @@ internal final class MissingPermissionException: GenericException<String> {
72
72
  "Missing permission for uri: \(param)"
73
73
  }
74
74
  }
75
+
76
+ internal final class PickingInProgressException: Exception {
77
+ override var reason: String {
78
+ "File picking is already in progress"
79
+ }
80
+ }
81
+
82
+ internal final class MissingViewControllerException: Exception {
83
+ override var reason: String {
84
+ "No view controller available for presenting file picker"
85
+ }
86
+ }
87
+
88
+ internal final class FilePickingCancelledException: Exception {
89
+ override var reason: String {
90
+ "File picking was cancelled by the user"
91
+ }
92
+ }
93
+
94
+ internal final class FeatureNotAvailableOnPlatformException: Exception {
95
+ override var reason: String {
96
+ "This feature is not available on this platform"
97
+ }
98
+ }
@@ -4,6 +4,10 @@ import ExpoModulesCore
4
4
 
5
5
  @available(iOS 14, tvOS 14, *)
6
6
  public final class FileSystemModule: Module {
7
+ #if os(iOS)
8
+ private lazy var filePickingHandler = FilePickingHandler(module: self)
9
+ #endif
10
+
7
11
  var documentDirectory: URL? {
8
12
  return appContext?.config.documentDirectory
9
13
  }
@@ -31,13 +35,20 @@ public final class FileSystemModule: Module {
31
35
  public func definition() -> ModuleDefinition {
32
36
  Name("FileSystem")
33
37
 
34
- Constants {
35
- return [
36
- "documentDirectory": documentDirectory?.absoluteString,
37
- "cacheDirectory": cacheDirectory?.absoluteString,
38
- "bundleDirectory": Bundle.main.bundlePath,
39
- "appleSharedContainers": getAppleSharedContainers()
40
- ]
38
+ Constant("documentDirectory") {
39
+ return documentDirectory?.absoluteString
40
+ }
41
+
42
+ Constant("cacheDirectory") {
43
+ return cacheDirectory?.absoluteString
44
+ }
45
+
46
+ Constant("bundleDirectory") {
47
+ return Bundle.main.bundlePath
48
+ }
49
+
50
+ Constant("appleSharedContainers") {
51
+ return getAppleSharedContainers()
41
52
  }
42
53
 
43
54
  Property("totalDiskSpace") {
@@ -95,6 +106,20 @@ public final class FileSystemModule: Module {
95
106
  downloadTask.resume()
96
107
  }
97
108
 
109
+ AsyncFunction("pickFileAsync") { (initialUri: URL?, mimeType: String?, promise: Promise) in
110
+ #if os(iOS)
111
+ filePickingHandler.presentDocumentPicker(
112
+ picker: createFilePicker(initialUri: initialUri, mimeType: mimeType),
113
+ isDirectory: false,
114
+ initialUri: initialUri,
115
+ mimeType: mimeType,
116
+ promise: promise
117
+ )
118
+ #else
119
+ promise.reject(FeatureNotAvailableOnPlatformException())
120
+ #endif
121
+ }.runOnQueue(.main)
122
+
98
123
  Function("info") { (url: URL) in
99
124
  let output = PathInfo()
100
125
  output.exists = false
@@ -27,12 +27,16 @@ public final class FileSystemLegacyModule: Module {
27
27
  public func definition() -> ModuleDefinition {
28
28
  Name("ExponentFileSystem")
29
29
 
30
- Constants {
31
- return [
32
- "documentDirectory": documentDirectory?.absoluteString,
33
- "cacheDirectory": cacheDirectory?.absoluteString,
34
- "bundleDirectory": Bundle.main.bundlePath
35
- ]
30
+ Constant("documentDirectory") {
31
+ return documentDirectory?.absoluteString
32
+ }
33
+
34
+ Constant("cacheDirectory") {
35
+ return cacheDirectory?.absoluteString
36
+ }
37
+
38
+ Constant("bundleDirectory") {
39
+ return Bundle.main.bundlePath
36
40
  }
37
41
 
38
42
  Events(EVENT_DOWNLOAD_PROGRESS, EVENT_UPLOAD_PROGRESS)
@@ -0,0 +1 @@
1
+ 267e88a3c5d6745c834050282f9a45c0305f51c7b8554e18e0b68a16ab337edb
@@ -0,0 +1 @@
1
+ b8f0a84aa8f6377f6fb162699e663d8e9de63caff453a37513e1cfeeaaa050261f8ae32032f15e8968e8591d518531d46e8e549c745b2998ee16fc7578903872
@@ -0,0 +1 @@
1
+ 25644f10378a71e515dcfe1df64fb41fef0862fdfbe9cf52ac91675939cd76fb
@@ -0,0 +1 @@
1
+ 56d4b780eb2b6164377db2d9756e9d1d6872436d2313f75a77b4ffce8be47d92c2fc502cc87369554a595d1844763bdb6ce3d14dc68ef849379070a259f920f3
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.filesystem",
6
- "version": "19.0.7",
6
+ "version": "19.0.9",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -75,13 +75,13 @@
75
75
  ],
76
76
  "files": [
77
77
  {
78
- "name": "expo.modules.filesystem-19.0.7.aar",
79
- "url": "expo.modules.filesystem-19.0.7.aar",
80
- "size": 376534,
81
- "sha512": "de4ccf9ef1c373a39e75d149e717061316cba471c546ad5247bc629083868d5e8700322898b147d22aa845fcd9e5f0ec1fca48c0d76025dddb41b3b300360627",
82
- "sha256": "3b1f05d11977bd8acba506764a3ed15e1bc517e7aaec57112545923c8b81ab04",
83
- "sha1": "65ea240b61a6bafa919d7fd66917aa1bbbb4fbc9",
84
- "md5": "3131a757a0b15f33c69b92145bbdbfbe"
78
+ "name": "expo.modules.filesystem-19.0.9.aar",
79
+ "url": "expo.modules.filesystem-19.0.9.aar",
80
+ "size": 386221,
81
+ "sha512": "56d4b780eb2b6164377db2d9756e9d1d6872436d2313f75a77b4ffce8be47d92c2fc502cc87369554a595d1844763bdb6ce3d14dc68ef849379070a259f920f3",
82
+ "sha256": "25644f10378a71e515dcfe1df64fb41fef0862fdfbe9cf52ac91675939cd76fb",
83
+ "sha1": "91a70d10d282ea3c01290747edd6b4f19226ad65",
84
+ "md5": "5af511777ab5671351368ebf881eb54b"
85
85
  }
86
86
  ]
87
87
  },
@@ -153,13 +153,13 @@
153
153
  ],
154
154
  "files": [
155
155
  {
156
- "name": "expo.modules.filesystem-19.0.7.aar",
157
- "url": "expo.modules.filesystem-19.0.7.aar",
158
- "size": 376534,
159
- "sha512": "de4ccf9ef1c373a39e75d149e717061316cba471c546ad5247bc629083868d5e8700322898b147d22aa845fcd9e5f0ec1fca48c0d76025dddb41b3b300360627",
160
- "sha256": "3b1f05d11977bd8acba506764a3ed15e1bc517e7aaec57112545923c8b81ab04",
161
- "sha1": "65ea240b61a6bafa919d7fd66917aa1bbbb4fbc9",
162
- "md5": "3131a757a0b15f33c69b92145bbdbfbe"
156
+ "name": "expo.modules.filesystem-19.0.9.aar",
157
+ "url": "expo.modules.filesystem-19.0.9.aar",
158
+ "size": 386221,
159
+ "sha512": "56d4b780eb2b6164377db2d9756e9d1d6872436d2313f75a77b4ffce8be47d92c2fc502cc87369554a595d1844763bdb6ce3d14dc68ef849379070a259f920f3",
160
+ "sha256": "25644f10378a71e515dcfe1df64fb41fef0862fdfbe9cf52ac91675939cd76fb",
161
+ "sha1": "91a70d10d282ea3c01290747edd6b4f19226ad65",
162
+ "md5": "5af511777ab5671351368ebf881eb54b"
163
163
  }
164
164
  ]
165
165
  },
@@ -173,13 +173,13 @@
173
173
  },
174
174
  "files": [
175
175
  {
176
- "name": "expo.modules.filesystem-19.0.7-sources.jar",
177
- "url": "expo.modules.filesystem-19.0.7-sources.jar",
178
- "size": 28557,
179
- "sha512": "883e3e975a1c678ab873b0e1a009d6b2e047daf7e3a21a8444a848a6f67b93ede413ae71029d59732541d9aa7bd7c9067626b0fd70a13e1d428da0e1e5a3bd9d",
180
- "sha256": "d40b6af1ade1a3e62958afbeb12170073ec4b0e9171e20ba91cdb1e1ae1b04ac",
181
- "sha1": "d674cc8fccd186f29334b506c24efcfdfac2e40a",
182
- "md5": "c155ff9ad88368334bea4f91422d8d32"
176
+ "name": "expo.modules.filesystem-19.0.9-sources.jar",
177
+ "url": "expo.modules.filesystem-19.0.9-sources.jar",
178
+ "size": 28550,
179
+ "sha512": "b8f0a84aa8f6377f6fb162699e663d8e9de63caff453a37513e1cfeeaaa050261f8ae32032f15e8968e8591d518531d46e8e549c745b2998ee16fc7578903872",
180
+ "sha256": "267e88a3c5d6745c834050282f9a45c0305f51c7b8554e18e0b68a16ab337edb",
181
+ "sha1": "1c9d91c71b0534cc4967a352ccb7864aa71054c1",
182
+ "md5": "792cb40c62c2c908a410b672981f14b0"
183
183
  }
184
184
  ]
185
185
  }
@@ -0,0 +1 @@
1
+ c3fee8526e6dc742ae83b09b793e4a476aee276ea9b3e2a21e0fa2f78000cd3b
@@ -0,0 +1 @@
1
+ 31096e7861ab7a804084e1d3edf0b8b1a7997878f3b6735ec7efdb06d43b859c193c03dd2a2825b2e433497ad9536801bb3fb14eb523aae39b4b7f08079ebc78
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.filesystem</artifactId>
12
- <version>19.0.7</version>
12
+ <version>19.0.9</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.filesystem</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 4d2fa7b11d77a88b8bb8c75aad95d1e76ff9755d1025a7dacb56d619e9be64ec
@@ -0,0 +1 @@
1
+ 7cdab1187688086f5af415d5f37249c35e653a3ca4d53b54833cd3efa3a102f7ae23efe89e8d8c4ce7f06d64f648e580010618705a6a4a3d55451e329753b209
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.filesystem</artifactId>
5
5
  <versioning>
6
- <latest>19.0.7</latest>
7
- <release>19.0.7</release>
6
+ <latest>19.0.9</latest>
7
+ <release>19.0.9</release>
8
8
  <versions>
9
- <version>19.0.7</version>
9
+ <version>19.0.9</version>
10
10
  </versions>
11
- <lastUpdated>20250831124212</lastUpdated>
11
+ <lastUpdated>20250903164526</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- dcab33e619a12cb1280ed5526609c42d
1
+ 1623da39a3e9b7fb51b363c2a6086c87
@@ -1 +1 @@
1
- 238a976822d6a261fa7f76460d534d4f5934233f
1
+ dc9e3d70554e9d5ed368703d0ac6e5bfc39efbf3
@@ -1 +1 @@
1
- 3693e2c2f2b219f586d17150a2433838d437328d308c677cbcb50d8d5da61709
1
+ 92d61650cdffdbb0b7aae66de414cac1391db551fc9ca5c88d5a1e63d1b58080
@@ -1 +1 @@
1
- 3959d1f0b20eec078018d1dbc67f436883b499575c2b2175e940500c8e822e569509a3b0f7141f4d3c772b0816d22d0bdf9c5993fb110983f8be35f8c7f195dc
1
+ 43e9412d18e213e209b889b4dd5aeaeb91f0ff1e37ce059ef396886987d9ca20e732de9296063c606047af447c72259af9cf1ed8f251a6b3e72ad489b7ab5c29
package/next.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './src';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-file-system",
3
- "version": "19.0.7",
3
+ "version": "19.0.9",
4
4
  "description": "Provides access to the local file system on the device.",
5
5
  "main": "src/index.ts",
6
6
  "types": "build/index.d.ts",
@@ -35,12 +35,12 @@
35
35
  "preset": "expo-module-scripts"
36
36
  },
37
37
  "devDependencies": {
38
- "expo-module-scripts": "^5.0.5",
39
- "jest-expo": "~54.0.5"
38
+ "expo-module-scripts": "^5.0.6",
39
+ "jest-expo": "~54.0.7"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "expo": "*",
43
43
  "react-native": "*"
44
44
  },
45
- "gitHead": "1dafdaa317c182191909a94a355c8b08a2654783"
45
+ "gitHead": "f97e6d1cae0cb14d5eed1b08fad6d12a7144af3a"
46
46
  }
@@ -270,16 +270,15 @@ export declare class File {
270
270
  ): Promise<File>;
271
271
 
272
272
  /**
273
- * A static method that opens a file picker to select a single file of specified type.
273
+ * A static method that opens a file picker to select a single file of specified type. On iOS, it returns a temporary copy of the file leaving the original file untouched.
274
274
  *
275
- * @platform android
275
+ * Selecting multiple files is not supported yet.
276
276
  *
277
277
  * @param initialUri An optional URI pointing to an initial folder on which the file picker is opened.
278
278
  * @param mimeType A mime type that is used to filter out files that can be picked out.
279
- * @returns a `File` instance.
280
- * @platform android
279
+ * @returns a `File` instance or an array of `File` instances.
281
280
  */
282
- static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File>;
281
+ static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File | File[]>;
283
282
 
284
283
  /**
285
284
  * A size of the file in bytes. 0 if the file does not exist, or it cannot be read.
package/src/index.ts CHANGED
@@ -9,3 +9,5 @@ export {
9
9
  type PathInfo,
10
10
  type DirectoryInfo,
11
11
  } from './ExpoFileSystem.types';
12
+
13
+ export * from './legacyWarnings';
@@ -0,0 +1,163 @@
1
+ import type {
2
+ DownloadOptions,
3
+ FileSystemNetworkTaskProgressCallback,
4
+ DownloadProgressData,
5
+ UploadProgressData,
6
+ FileInfo,
7
+ FileSystemDownloadResult,
8
+ FileSystemUploadOptions,
9
+ FileSystemUploadResult,
10
+ ReadingOptions,
11
+ WritingOptions,
12
+ DeletingOptions,
13
+ InfoOptions,
14
+ RelocatingOptions,
15
+ MakeDirectoryOptions,
16
+ } from './legacy/FileSystem.types';
17
+
18
+ function errorOnLegacyMethodUse(methodName: string): Error {
19
+ const message = `Method ${methodName} imported from "expo-file-system" is deprecated.\nYou can migrate to the new filesystem API using "File" and "Directory" classes or import the legacy API from "expo-file-system/legacy".\nAPI reference and examples are available in the filesystem docs: https://docs.expo.dev/versions/v54.0.0/sdk/filesystem/`;
20
+ console.warn(message);
21
+ return new Error(message);
22
+ }
23
+
24
+ /**
25
+ * @deprecated Use `new File().info` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
26
+ */
27
+ export async function getInfoAsync(fileUri: string, options: InfoOptions = {}): Promise<FileInfo> {
28
+ throw errorOnLegacyMethodUse('getInfoAsync');
29
+ }
30
+
31
+ /**
32
+ * @deprecated Use `new File().text()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
33
+ */
34
+ export async function readAsStringAsync(
35
+ fileUri: string,
36
+ options: ReadingOptions = {}
37
+ ): Promise<string> {
38
+ throw errorOnLegacyMethodUse('readAsStringAsync');
39
+ }
40
+
41
+ /**
42
+ * @deprecated Import this method from `expo-file-system/legacy`. This method will throw in runtime.
43
+ */
44
+ export async function getContentUriAsync(fileUri: string): Promise<string> {
45
+ throw errorOnLegacyMethodUse('getContentUriAsync');
46
+ }
47
+
48
+ /**
49
+ * @deprecated Use `new File().write()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
50
+ */
51
+ export async function writeAsStringAsync(
52
+ fileUri: string,
53
+ contents: string,
54
+ options: WritingOptions = {}
55
+ ): Promise<void> {
56
+ throw errorOnLegacyMethodUse('writeAsStringAsync');
57
+ }
58
+
59
+ /**
60
+ * @deprecated Use `new File().delete()` or `new Directory().delete()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
61
+ */
62
+ export async function deleteAsync(fileUri: string, options: DeletingOptions = {}): Promise<void> {
63
+ throw errorOnLegacyMethodUse('deleteAsync');
64
+ }
65
+
66
+ /**
67
+ * @deprecated
68
+ */
69
+ export async function deleteLegacyDocumentDirectoryAndroid(): Promise<void> {
70
+ throw errorOnLegacyMethodUse('deleteLegacyDocumentDirectoryAndroid');
71
+ }
72
+
73
+ /**
74
+ * @deprecated Use `new File().move()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
75
+ */
76
+ export async function moveAsync(options: RelocatingOptions): Promise<void> {
77
+ throw errorOnLegacyMethodUse('moveAsync');
78
+ }
79
+
80
+ /**
81
+ * @deprecated Use `new File().copy()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
82
+ */
83
+ export async function copyAsync(options: RelocatingOptions): Promise<void> {
84
+ throw errorOnLegacyMethodUse('copyAsync');
85
+ }
86
+
87
+ /**
88
+ * @deprecated Use `new Directory().create()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
89
+ */
90
+ export async function makeDirectoryAsync(
91
+ fileUri: string,
92
+ options: MakeDirectoryOptions = {}
93
+ ): Promise<void> {
94
+ throw errorOnLegacyMethodUse('makeDirectoryAsync');
95
+ }
96
+
97
+ /**
98
+ * @deprecated Use `new Directory().list()` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
99
+ */
100
+ export async function readDirectoryAsync(fileUri: string): Promise<string[]> {
101
+ throw errorOnLegacyMethodUse('readDirectoryAsync');
102
+ }
103
+
104
+ /**
105
+ * @deprecated Use `Paths.availableDiskSpace` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
106
+ */
107
+ export async function getFreeDiskStorageAsync(): Promise<number> {
108
+ throw errorOnLegacyMethodUse('getFreeDiskStorageAsync');
109
+ }
110
+
111
+ /**
112
+ * @deprecated Use `Paths.totalDiskSpace` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
113
+ */
114
+ export async function getTotalDiskCapacityAsync(): Promise<number> {
115
+ throw errorOnLegacyMethodUse('getTotalDiskCapacityAsync');
116
+ }
117
+
118
+ /**
119
+ * @deprecated Use `File.downloadFileAsync` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
120
+ */
121
+ export async function downloadAsync(
122
+ uri: string,
123
+ fileUri: string,
124
+ options: DownloadOptions = {}
125
+ ): Promise<FileSystemDownloadResult> {
126
+ throw errorOnLegacyMethodUse('downloadAsync');
127
+ }
128
+
129
+ /**
130
+ * @deprecated Use `@expo/fetch` or import this method from `expo-file-system/legacy`. This method will throw in runtime.
131
+ */
132
+ export async function uploadAsync(
133
+ url: string,
134
+ fileUri: string,
135
+ options: FileSystemUploadOptions = {}
136
+ ): Promise<FileSystemUploadResult> {
137
+ throw errorOnLegacyMethodUse('uploadAsync');
138
+ }
139
+
140
+ /**
141
+ * @deprecated Import this method from `expo-file-system/legacy`. This method will throw in runtime.
142
+ */
143
+ export function createDownloadResumable(
144
+ uri: string,
145
+ fileUri: string,
146
+ options?: DownloadOptions,
147
+ callback?: FileSystemNetworkTaskProgressCallback<DownloadProgressData>,
148
+ resumeData?: string
149
+ ): any {
150
+ throw errorOnLegacyMethodUse('createDownloadResumable');
151
+ }
152
+
153
+ /**
154
+ * @deprecated Import this method from `expo-file-system/legacy`. This method will throw in runtime.
155
+ */
156
+ export function createUploadTask(
157
+ url: string,
158
+ fileUri: string,
159
+ options?: FileSystemUploadOptions,
160
+ callback?: FileSystemNetworkTaskProgressCallback<UploadProgressData>
161
+ ): any {
162
+ throw errorOnLegacyMethodUse('createUploadTask');
163
+ }
@@ -1 +0,0 @@
1
- d40b6af1ade1a3e62958afbeb12170073ec4b0e9171e20ba91cdb1e1ae1b04ac
@@ -1 +0,0 @@
1
- 883e3e975a1c678ab873b0e1a009d6b2e047daf7e3a21a8444a848a6f67b93ede413ae71029d59732541d9aa7bd7c9067626b0fd70a13e1d428da0e1e5a3bd9d
@@ -1 +0,0 @@
1
- 3b1f05d11977bd8acba506764a3ed15e1bc517e7aaec57112545923c8b81ab04
@@ -1 +0,0 @@
1
- de4ccf9ef1c373a39e75d149e717061316cba471c546ad5247bc629083868d5e8700322898b147d22aa845fcd9e5f0ec1fca48c0d76025dddb41b3b300360627
@@ -1 +0,0 @@
1
- df378e667196c0a9fb856d02a0a7d4b761d3975d0345a970338cc8fcf7c17bff
@@ -1 +0,0 @@
1
- e9ef84e5f83b6e1705e1b5a7802682aec4f49c2f91a001291c9bdd79d1b1a71f51b9fa08b8204e1dc08522a9e0c6214288d4a8e87a1a1ac6806ccbcb08e038e7
@@ -1 +0,0 @@
1
- 711ea03d039b3c3ceabdc4f9de6d3c45fa054f5892763c708de0e416135e7b41
@@ -1 +0,0 @@
1
- 9ce4435eef9347f5860fce84c95feca14bf7746d4d6ed079f27c25ab77bc1b3249a8df72ea4c946c8200efdc4cebd38573fef10fb9bf931512e0e5de2a19c6ab