expo-file-system 19.1.0-canary-20250830-81bb199 → 19.1.0-canary-20250930-9dc59d3

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 (78) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/filesystem/FileSystemDirectory.kt +7 -0
  4. package/android/src/main/java/expo/modules/filesystem/FileSystemFile.kt +17 -0
  5. package/android/src/main/java/expo/modules/filesystem/{legacy/FileSystemFileProvider.kt → FileSystemFileProvider.kt} +1 -1
  6. package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +22 -8
  7. package/android/src/main/java/expo/modules/filesystem/FileSystemNextRecords.kt +17 -2
  8. package/android/src/main/java/expo/modules/filesystem/legacy/FileSystemLegacyModule.kt +11 -5
  9. package/build/ExpoFileSystem.types.d.ts +75 -17
  10. package/build/ExpoFileSystem.types.d.ts.map +1 -1
  11. package/build/ExpoFileSystem.web.d.ts +20 -0
  12. package/build/ExpoFileSystem.web.d.ts.map +1 -0
  13. package/build/FileSystem.d.ts +4 -4
  14. package/build/index.d.ts +2 -1
  15. package/build/index.d.ts.map +1 -1
  16. package/build/legacyWarnings.d.ts +66 -0
  17. package/build/legacyWarnings.d.ts.map +1 -0
  18. package/expo-module.config.json +1 -1
  19. package/ios/FilePickingHandler.swift +95 -0
  20. package/ios/FilePickingUtils.swift +167 -0
  21. package/ios/FileSystemDirectory.swift +46 -34
  22. package/ios/FileSystemExceptions.swift +36 -0
  23. package/ios/FileSystemFile.swift +58 -50
  24. package/ios/FileSystemModule.swift +60 -10
  25. package/ios/FileSystemPath.swift +17 -0
  26. package/ios/FileSystemRecords.swift +11 -0
  27. package/ios/Legacy/FileSystemLegacyModule.swift +10 -6
  28. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar +0 -0
  29. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar.md5 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar.sha1 +1 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar.sha256 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar.sha512 +1 -0
  33. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar +0 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar.md5 +1 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar.sha1 +1 -0
  36. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar.sha256 +1 -0
  37. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar.sha512 +1 -0
  38. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.module → 19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.module} +23 -23
  39. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.module.md5 +1 -0
  40. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.module.sha1 +1 -0
  41. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.module.sha256 +1 -0
  42. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.module.sha512 +1 -0
  43. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.pom → 19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.pom} +1 -1
  44. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.pom.md5 +1 -0
  45. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.pom.sha1 +1 -0
  46. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.pom.sha256 +1 -0
  47. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.pom.sha512 +1 -0
  48. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml +4 -4
  49. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.md5 +1 -1
  50. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha1 +1 -1
  51. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256 +1 -1
  52. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512 +1 -1
  53. package/next.ts +1 -0
  54. package/package.json +4 -4
  55. package/src/ExpoFileSystem.types.ts +78 -17
  56. package/src/ExpoFileSystem.web.ts +48 -0
  57. package/src/FileSystem.ts +4 -4
  58. package/src/index.ts +5 -1
  59. package/src/legacyWarnings.ts +163 -0
  60. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199-sources.jar +0 -0
  61. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199-sources.jar.md5 +0 -1
  62. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199-sources.jar.sha1 +0 -1
  63. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199-sources.jar.sha256 +0 -1
  64. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199-sources.jar.sha512 +0 -1
  65. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.aar +0 -0
  66. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.aar.md5 +0 -1
  67. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.aar.sha1 +0 -1
  68. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.aar.sha256 +0 -1
  69. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.aar.sha512 +0 -1
  70. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.module.md5 +0 -1
  71. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.module.sha1 +0 -1
  72. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.module.sha256 +0 -1
  73. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.module.sha512 +0 -1
  74. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.pom.md5 +0 -1
  75. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.pom.sha1 +0 -1
  76. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.pom.sha256 +0 -1
  77. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250830-81bb199/expo.modules.filesystem-19.1.0-canary-20250830-81bb199.pom.sha512 +0 -1
  78. /package/android/src/main/{java/expo/modules/filesystem/AndroidManifest.xml → AndroidManifest.xml} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,12 +6,67 @@
6
6
 
7
7
  ### 🎉 New features
8
8
 
9
- - Add `rename` method for files and directories ([#39138](https://github.com/expo/expo/pull/39138) by [@kosmydel](https://github.com/kosmydel))
9
+ - Add write options for base64 encoded bytes. ([#39963](https://github.com/expo/expo/pull/39963) by [@aleqsio](https://github.com/aleqsio))
10
+ - add `idempotent` option to `downloadFileAsync` ([#39681](https://github.com/expo/expo/pull/39681) by [@vonovak](https://github.com/vonovak))
10
11
 
11
12
  ### 🐛 Bug fixes
12
13
 
14
+ - Fix typedoc in the File class. ([#40064](https://github.com/expo/expo/pull/40064) by [@aleqsio](https://github.com/aleqsio))
15
+ - [Android] Fix getContentUri. ([#40001](https://github.com/expo/expo/pull/40001) by [@aleqsio](https://github.com/aleqsio))
16
+
13
17
  ### 💡 Others
14
18
 
19
+ ## 19.0.14 — 2025-09-13
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
23
+ ## 19.0.13 — 2025-09-12
24
+
25
+ ### 🐛 Bug fixes
26
+
27
+ - [Android] Fix incorrect AndroidManifest.xml location. ([#39134](https://github.com/expo/expo/pull/39134) by [@robertying](https://github.com/robertying))
28
+
29
+ ## 19.0.12 — 2025-09-11
30
+
31
+ _This version does not introduce any user-facing changes._
32
+
33
+ ## 19.0.11 — 2025-09-10
34
+
35
+ ### 🎉 New features
36
+
37
+ - [iOS] Add `pickDirectoryAsync` support ([#39210](https://github.com/expo/expo/pull/39210) by [@kosmydel](https://github.com/kosmydel))
38
+
39
+ ### 🐛 Bug fixes
40
+
41
+ - Add minimal web stub to fix broken imports on web ([#39400](https://github.com/expo/expo/pull/39400) by [@LeonDvlpmnt](https://github.com/LeonDvlpmnt))
42
+
43
+ ## 19.0.10 — 2025-09-08
44
+
45
+ _This version does not introduce any user-facing changes._
46
+
47
+ ## 19.0.9 — 2025-09-03
48
+
49
+ ### 🎉 New features
50
+
51
+ - Add stubs for legacy methods imported from "expo-file-system". ([#39244](https://github.com/expo/expo/pull/39244) by [@aleqsio](https://github.com/aleqsio))
52
+
53
+ ### 🐛 Bug fixes
54
+
55
+ - [iOS] Fix tvOS compile error. ([#39345](https://github.com/expo/expo/pull/39345) by [@douglowder](https://github.com/douglowder))
56
+
57
+ ## 19.0.8 — 2025-09-02
58
+
59
+ ### 🎉 New features
60
+
61
+ - [iOS] Add `pickFileAsync` support ([#39173](https://github.com/expo/expo/pull/39173) by [@kosmydel](https://github.com/kosmydel))
62
+
63
+ ## 19.0.7 — 2025-08-31
64
+
65
+ ### 🎉 New features
66
+
67
+ - Add `rename` method for files and directories ([#39138](https://github.com/expo/expo/pull/39138) by [@kosmydel](https://github.com/kosmydel))
68
+ - Add `idempotent` option for creating directories ([#39121](https://github.com/expo/expo/pull/39121) by [@kosmydel](https://github.com/kosmydel))
69
+
15
70
  ## 19.0.6 — 2025-08-26
16
71
 
17
72
  _This version does not introduce any user-facing changes._
@@ -39,6 +94,7 @@ _This version does not introduce any user-facing changes._
39
94
  ### 💡 Others
40
95
 
41
96
  - Update typings for `typescript@5.9` ([#38833](https://github.com/expo/expo/pull/38833) by [@kitten](https://github.com/kitten))
97
+ - Change Constants to Constant/Property. ([#38926](https://github.com/expo/expo/pull/38926) by [@jakex7](https://github.com/jakex7))
42
98
 
43
99
  ## 19.0.0 — 2025-08-13
44
100
 
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '19.1.0-canary-20250830-81bb199'
7
+ version = '19.1.0-canary-20250930-9dc59d3'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.filesystem"
11
11
  defaultConfig {
12
12
  versionCode 30
13
- versionName "19.1.0-canary-20250830-81bb199"
13
+ versionName "19.1.0-canary-20250930-9dc59d3"
14
14
  }
15
15
  }
16
16
 
@@ -53,6 +53,9 @@ class FileSystemDirectory(uri: Uri) : FileSystemPath(uri) {
53
53
  fun create(options: CreateOptions = CreateOptions()) {
54
54
  validateType()
55
55
  validatePermission(Permission.WRITE)
56
+ if (!needsCreation(options)) {
57
+ return
58
+ }
56
59
  validateCanCreate(options)
57
60
  if (uri.isContentUri) {
58
61
  throw UnableToCreateException("create function does not work with SAF Uris, use `createDirectory` and `createFile` instead")
@@ -101,4 +104,8 @@ class FileSystemDirectory(uri: Uri) : FileSystemPath(uri) {
101
104
  val uriString = file.uri.toString()
102
105
  return if (uriString.endsWith("/")) uriString else "$uriString/"
103
106
  }
107
+
108
+ fun needsCreation(options: CreateOptions): Boolean {
109
+ return !file.exists() || !options.idempotent
110
+ }
104
111
  }
@@ -80,6 +80,23 @@ class FileSystemFile(uri: Uri) : FileSystemPath(uri) {
80
80
  }
81
81
  }
82
82
 
83
+ fun write(content: ByteArray) {
84
+ validateType()
85
+ validatePermission(Permission.WRITE)
86
+ if (!exists) {
87
+ create()
88
+ }
89
+ if (uri.isContentUri) {
90
+ file.outputStream().use { outputStream ->
91
+ outputStream.write(content)
92
+ }
93
+ } else {
94
+ FileOutputStream(javaFile).use {
95
+ it.write(content)
96
+ }
97
+ }
98
+ }
99
+
83
100
  fun asString(): String {
84
101
  val uriString = file.uri.toString()
85
102
  return if (uriString.endsWith("/")) uriString.dropLast(1) else uriString
@@ -1,4 +1,4 @@
1
- package expo.modules.filesystem.legacy
1
+ package expo.modules.filesystem
2
2
 
3
3
  import androidx.core.content.FileProvider
4
4
 
@@ -2,7 +2,10 @@ package expo.modules.filesystem
2
2
 
3
3
  import android.content.Context
4
4
  import android.net.Uri
5
+ import android.os.Build
6
+ import android.util.Base64
5
7
  import android.webkit.URLUtil
8
+ import androidx.annotation.RequiresApi
6
9
  import expo.modules.interfaces.filesystem.Permission
7
10
  import expo.modules.kotlin.activityresult.AppContextActivityResultLauncher
8
11
  import expo.modules.kotlin.apifeatures.EitherType
@@ -24,15 +27,22 @@ class FileSystemModule : Module() {
24
27
  private val context: Context
25
28
  get() = appContext.reactContext ?: throw Exceptions.AppContextLost()
26
29
 
30
+ @RequiresApi(Build.VERSION_CODES.O)
27
31
  @OptIn(EitherType::class)
28
32
  override fun definition() = ModuleDefinition {
29
33
  Name("FileSystem")
30
34
 
31
- Constants(
32
- "documentDirectory" to Uri.fromFile(context.filesDir).toString() + "/",
33
- "cacheDirectory" to Uri.fromFile(context.cacheDir).toString() + "/",
34
- "bundleDirectory" to "asset://"
35
- )
35
+ Constant("documentDirectory") {
36
+ Uri.fromFile(context.filesDir).toString() + "/"
37
+ }
38
+
39
+ Constant("cacheDirectory") {
40
+ Uri.fromFile(context.cacheDir).toString() + "/"
41
+ }
42
+
43
+ Constant("bundleDirectory") {
44
+ "asset://"
45
+ }
36
46
 
37
47
  Property("totalDiskSpace") {
38
48
  File(context.filesDir.path).totalSpace
@@ -68,7 +78,7 @@ class FileSystemModule : Module() {
68
78
  to.javaFile
69
79
  }
70
80
 
71
- if (destination.exists()) {
81
+ if (options?.idempotent != true && destination.exists()) {
72
82
  throw DestinationAlreadyExistsException()
73
83
  }
74
84
 
@@ -132,10 +142,14 @@ class FileSystemModule : Module() {
132
142
  file.create(options ?: CreateOptions())
133
143
  }
134
144
 
135
- Function("write") { file: FileSystemFile, content: Either<String, TypedArray> ->
145
+ Function("write") { file: FileSystemFile, content: Either<String, TypedArray>, options: WriteOptions? ->
136
146
  if (content.`is`(String::class)) {
137
147
  content.get(String::class).let {
138
- file.write(it)
148
+ if (options?.encoding == EncodingType.BASE64) {
149
+ file.write(Base64.decode(it, Base64.DEFAULT))
150
+ } else {
151
+ file.write(it)
152
+ }
139
153
  }
140
154
  }
141
155
  if (content.`is`(TypedArray::class)) {
@@ -2,6 +2,7 @@ package expo.modules.filesystem
2
2
 
3
3
  import expo.modules.kotlin.records.Field
4
4
  import expo.modules.kotlin.records.Record
5
+ import expo.modules.kotlin.types.Enumerable
5
6
 
6
7
  data class InfoOptions(
7
8
  @Field
@@ -12,12 +13,26 @@ data class CreateOptions(
12
13
  @Field
13
14
  val intermediates: Boolean = false,
14
15
  @Field
15
- val overwrite: Boolean = false
16
+ val overwrite: Boolean = false,
17
+ @Field
18
+ val idempotent: Boolean = false
19
+ ) : Record
20
+
21
+ enum class EncodingType(val value: String) : Enumerable {
22
+ UTF8("utf8"),
23
+ BASE64("base64")
24
+ }
25
+
26
+ data class WriteOptions(
27
+ @Field
28
+ val encoding: EncodingType = EncodingType.UTF8
16
29
  ) : Record
17
30
 
18
31
  data class DownloadOptions(
19
32
  @Field
20
- val headers: Map<String, String> = emptyMap()
33
+ val headers: Map<String, String> = emptyMap(),
34
+ @Field
35
+ val idempotent: Boolean = false
21
36
  ) : Record
22
37
 
23
38
  data class FileInfo(
@@ -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,
@@ -1,15 +1,54 @@
1
- export type CreateOptions = {
1
+ export type FileCreateOptions = {
2
2
  /**
3
3
  * Whether to create intermediate directories if they do not exist.
4
4
  * @default false
5
5
  */
6
6
  intermediates?: boolean;
7
7
  /**
8
- * Whether to overwrite the file or directory if it exists.
8
+ * Whether to overwrite the file if it exists.
9
9
  * @default false
10
10
  */
11
11
  overwrite?: boolean;
12
12
  };
13
+ export declare enum EncodingType {
14
+ /**
15
+ * Standard encoding format.
16
+ */
17
+ UTF8 = "utf8",
18
+ /**
19
+ * Binary, radix-64 representation.
20
+ */
21
+ Base64 = "base64"
22
+ }
23
+ export type FileWriteOptions = {
24
+ /**
25
+ * The encoding format to use when writing the file.
26
+ * @default FileSystem.EncodingType.UTF8
27
+ */
28
+ encoding?: EncodingType | 'utf8' | 'base64';
29
+ };
30
+ export type DirectoryCreateOptions = {
31
+ /**
32
+ * Whether to create intermediate directories if they do not exist.
33
+ * @default false
34
+ */
35
+ intermediates?: boolean;
36
+ /**
37
+ * Whether to overwrite the directory if it exists.
38
+ * @default false
39
+ */
40
+ overwrite?: boolean;
41
+ /**
42
+ * This flag controls whether the `create` operation is idempotent
43
+ * (safe to call multiple times without error).
44
+ *
45
+ * If `true`, creating a file or directory that already exists will succeed silently.
46
+ * If `false`, an error will be thrown when the target already exists.
47
+ *
48
+ * @default false
49
+ */
50
+ idempotent?: boolean;
51
+ };
13
52
  export declare class Directory {
14
53
  /**
15
54
  * Creates an instance of a directory.
@@ -42,9 +81,9 @@ export declare class Directory {
42
81
  /**
43
82
  * Creates a directory that the current uri points to.
44
83
  *
45
- * @throws Error if the containing folder doesn't exist, the application has no read access to it or the directory (or a file with the same path) already exists.
84
+ * @throws Error if the containing folder doesn't exist, the application has no read access to it or the directory (or a file with the same path) already exists (unless `idempotent` is `true`).
46
85
  */
47
- create(options?: CreateOptions): void;
86
+ create(options?: DirectoryCreateOptions): void;
48
87
  createFile(name: string, mimeType: string | null): File;
49
88
  createDirectory(name: string): Directory;
50
89
  /**
@@ -86,9 +125,11 @@ export declare class Directory {
86
125
  size: number | null;
87
126
  /**
88
127
  * A static method that opens a file picker to select a directory.
128
+ *
129
+ * On iOS, the selected directory grants temporary read and write access for the current app session only. After the app restarts, you must prompt the user again to regain access.
130
+ *
89
131
  * @param initialUri An optional uri pointing to an initial folder on which the directory picker is opened.
90
- * @returns a `Directory` instance. The underlying uri will be a content URI on Android.
91
- * @platform android
132
+ * @returns a `Directory` instance. On Android, the underlying uri will be a content URI.
92
133
  */
93
134
  static pickDirectoryAsync(initialUri?: string): Promise<Directory>;
94
135
  }
@@ -99,6 +140,16 @@ export type DownloadOptions = {
99
140
  headers?: {
100
141
  [key: string]: string;
101
142
  };
143
+ /**
144
+ * This flag controls whether the `download` operation is idempotent
145
+ * (safe to call multiple times without error).
146
+ *
147
+ * If `true`, downloading a file that already exists overwrites the previous one.
148
+ * If `false`, an error is thrown when the target file already exists.
149
+ *
150
+ * @default false
151
+ */
152
+ idempotent?: boolean;
102
153
  };
103
154
  /**
104
155
  * Represents a file on the file system.
@@ -133,7 +184,7 @@ export declare class File {
133
184
  * Retrieves content of the file as base64.
134
185
  * @returns A promise that resolves with the contents of the file as a base64 string.
135
186
  */
136
- base64(): string;
187
+ base64(): Promise<string>;
137
188
  /**
138
189
  * Retrieves content of the file as base64.
139
190
  * @returns The contents of the file as a base64 string.
@@ -141,19 +192,19 @@ export declare class File {
141
192
  base64Sync(): string;
142
193
  /**
143
194
  * Retrieves byte content of the entire file.
144
- * @returns A promise that resolves with the contents of the file as a Uint8Array.
195
+ * @returns A promise that resolves with the contents of the file as a `Uint8Array`.
145
196
  */
146
197
  bytes(): Promise<Uint8Array<ArrayBuffer>>;
147
198
  /**
148
199
  * Retrieves byte content of the entire file.
149
- * @returns A promise that resolves with the contents of the file as a Uint8Array.
200
+ * @returns The contents of the file as a `Uint8Array`.
150
201
  */
151
202
  bytesSync(): Uint8Array;
152
203
  /**
153
204
  * Writes content to the file.
154
205
  * @param content The content to write into the file.
155
206
  */
156
- write(content: string | Uint8Array): void;
207
+ write(content: string | Uint8Array, options: FileWriteOptions): void;
157
208
  /**
158
209
  * Deletes a file.
159
210
  *
@@ -176,7 +227,7 @@ export declare class File {
176
227
  *
177
228
  * @throws Error if the containing folder doesn't exist, the application has no read access to it or the file (or directory with the same path) already exists.
178
229
  */
179
- create(options?: CreateOptions): void;
230
+ create(options?: FileCreateOptions): void;
180
231
  /**
181
232
  * Copies a file.
182
233
  */
@@ -197,10 +248,18 @@ export declare class File {
197
248
  /**
198
249
  * A static method that downloads a file from the network.
199
250
  *
251
+ * On Android, the response body streams directly into the target file. If the download fails after
252
+ * it starts, a partially written file may remain at the destination. On iOS, the download first
253
+ * completes in a temporary location and the file is moved into place only after success, so no
254
+ * file is left behind when the request fails.
255
+ *
200
256
  * @param url - The URL of the file to download.
201
257
  * @param destination - The destination directory or file. If a directory is provided, the resulting filename will be determined based on the response headers.
258
+ * @param options - Download options. When the destination already contains a file, the promise rejects with a `DestinationAlreadyExists` error unless `options.idempotent` is set to `true`. With `idempotent: true`, the download overwrites the existing file instead of failing.
202
259
  *
203
- * @returns A promise that resolves to the downloaded file.
260
+ * @returns A promise that resolves to the downloaded file. When the server responds with
261
+ * a non-2xx HTTP status, the promise rejects with an `UnableToDownload` error whose
262
+ * message includes the status code. No file is created in that scenario.
204
263
  *
205
264
  * @example
206
265
  * ```ts
@@ -209,16 +268,15 @@ export declare class File {
209
268
  */
210
269
  static downloadFileAsync(url: string, destination: Directory | File, options?: DownloadOptions): Promise<File>;
211
270
  /**
212
- * A static method that opens a file picker to select a single file of specified type.
271
+ * 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.
213
272
  *
214
- * @platform android
273
+ * Selecting multiple files is not supported yet.
215
274
  *
216
275
  * @param initialUri An optional URI pointing to an initial folder on which the file picker is opened.
217
276
  * @param mimeType A mime type that is used to filter out files that can be picked out.
218
- * @returns a `File` instance.
219
- * @platform android
277
+ * @returns A `File` instance or an array of `File` instances.
220
278
  */
221
- static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File>;
279
+ static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File | File[]>;
222
280
  /**
223
281
  * A size of the file in bytes. 0 if the file does not exist, or it cannot be read.
224
282
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFileSystem.types.d.ts","sourceRoot":"","sources":["../src/ExpoFileSystem.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;;;OAOG;gBACS,GA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OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC"}
@@ -0,0 +1,20 @@
1
+ declare class FileSystemFile {
2
+ constructor();
3
+ }
4
+ declare class FileSystemDirectory {
5
+ constructor();
6
+ }
7
+ declare const _default: {
8
+ FileSystemDirectory: typeof FileSystemDirectory;
9
+ FileSystemFile: typeof FileSystemFile;
10
+ downloadFileAsync: () => Promise<void>;
11
+ pickDirectoryAsync: () => Promise<void>;
12
+ pickFileAsync: () => Promise<void>;
13
+ readonly totalDiskSpace: number;
14
+ readonly availableDiskSpace: number;
15
+ readonly documentDirectory: string;
16
+ readonly cacheDirectory: string;
17
+ readonly bundleDirectory: string;
18
+ };
19
+ export default _default;
20
+ //# sourceMappingURL=ExpoFileSystem.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoFileSystem.web.d.ts","sourceRoot":"","sources":["../src/ExpoFileSystem.web.ts"],"names":[],"mappings":"AAAA,cAAM,cAAc;;CAInB;AAED,cAAM,mBAAmB;;CAIxB;;;;;;;6BAiBuB,MAAM;iCAIF,MAAM;gCAIP,MAAM;6BAIT,MAAM;8BAIL,MAAM;;AA/B/B,wBAmCE"}
@@ -36,7 +36,7 @@ export declare class Paths extends PathUtilities {
36
36
  * The constructor accepts an array of strings that are joined to create the file URI. The first argument can also be a `Directory` instance (like `Paths.cache`) or a `File` instance (which creates a new reference to the same file).
37
37
  * @example
38
38
  * ```ts
39
- * const file = new File(File.cache, "subdirName", "file.txt");
39
+ * const file = new File(Paths.cache, "subdirName", "file.txt");
40
40
  * ```
41
41
  */
42
42
  export declare class File extends ExpoFileSystem.FileSystemFile implements Blob {
@@ -47,7 +47,7 @@ export declare class File extends ExpoFileSystem.FileSystemFile implements Blob
47
47
  * @param uris An array of: `file:///` string URIs, `File` instances, and `Directory` instances representing an arbitrary location on the file system.
48
48
  * @example
49
49
  * ```ts
50
- * const file = new File(File.cache, "subdirName", "file.txt");
50
+ * const file = new File(Paths.cache, "subdirName", "file.txt");
51
51
  * ```
52
52
  */
53
53
  constructor(...uris: (string | File | Directory)[]);
@@ -75,7 +75,7 @@ export declare class File extends ExpoFileSystem.FileSystemFile implements Blob
75
75
  * The constructor accepts an array of strings that are joined to create the directory URI. The first argument can also be a `Directory` instance (like `Paths.cache`).
76
76
  * @example
77
77
  * ```ts
78
- * const directory = new Directory(File.cache, "subdirName");
78
+ * const directory = new Directory(Paths.cache, "subdirName");
79
79
  * ```
80
80
  */
81
81
  export declare class Directory extends ExpoFileSystem.FileSystemDirectory {
@@ -86,7 +86,7 @@ export declare class Directory extends ExpoFileSystem.FileSystemDirectory {
86
86
  * @param uris An array of: `file:///` string URIs, `File` instances, and `Directory` instances representing an arbitrary location on the file system.
87
87
  * @example
88
88
  * ```ts
89
- * const directory = new Directory(File.cache, "subdirName");
89
+ * const directory = new Directory(Paths.cache, "subdirName");
90
90
  * ```
91
91
  */
92
92
  constructor(...uris: (string | File | Directory)[]);
package/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './FileSystem';
2
- export { type CreateOptions, type FileHandle, type FileInfo, type InfoOptions, type PathInfo, type DirectoryInfo, } from './ExpoFileSystem.types';
2
+ export { type FileCreateOptions, type DirectoryCreateOptions, type FileHandle, type FileInfo, type InfoOptions, type PathInfo, type DirectoryInfo, type DownloadOptions, } 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,aAAa,EAClB,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,EAClB,KAAK,eAAe,GACrB,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,CAAC,IAAI,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAE3E;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAE/D;AAED;;GAEG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEjE;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,wBAAwB,CAAC,CAEnC;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAEjC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,qCAAqC,CAAC,oBAAoB,CAAC,EACtE,UAAU,CAAC,EAAE,MAAM,GAClB,GAAG,CAEL;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,uBAAuB,EACjC,QAAQ,CAAC,EAAE,qCAAqC,CAAC,kBAAkB,CAAC,GACnE,GAAG,CAEL"}
@@ -12,7 +12,7 @@
12
12
  "publication": {
13
13
  "groupId": "host.exp.exponent",
14
14
  "artifactId": "expo.modules.filesystem",
15
- "version": "19.1.0-canary-20250830-81bb199",
15
+ "version": "19.1.0-canary-20250930-9dc59d3",
16
16
  "repository": "local-maven-repo"
17
17
  }
18
18
  }