expo-file-system 19.1.0-canary-20250919-7a31b96 → 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 (63) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/filesystem/FileSystemFile.kt +17 -0
  4. package/android/src/main/java/expo/modules/filesystem/{legacy/FileSystemFileProvider.kt → FileSystemFileProvider.kt} +1 -1
  5. package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +10 -2
  6. package/android/src/main/java/expo/modules/filesystem/FileSystemNextRecords.kt +11 -0
  7. package/build/ExpoFileSystem.types.d.ts +31 -6
  8. package/build/ExpoFileSystem.types.d.ts.map +1 -1
  9. package/build/FileSystem.d.ts +4 -4
  10. package/build/index.d.ts +1 -1
  11. package/build/index.d.ts.map +1 -1
  12. package/expo-module.config.json +1 -1
  13. package/ios/FileSystemExceptions.swift +6 -0
  14. package/ios/FileSystemFile.swift +6 -0
  15. package/ios/FileSystemModule.swift +9 -2
  16. package/ios/FileSystemRecords.swift +9 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96-sources.jar → 19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar} +0 -0
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.module → 19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.module} +23 -23
  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.module.md5 +1 -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.module.sha1 +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.module.sha256 +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.module.sha512 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.pom → 19.1.0-canary-20250930-9dc59d3/expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.pom} +1 -1
  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.pom.md5 +1 -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.pom.sha1 +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.pom.sha256 +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.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/package.json +4 -4
  43. package/src/ExpoFileSystem.types.ts +33 -6
  44. package/src/FileSystem.ts +4 -4
  45. package/src/index.ts +1 -0
  46. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96-sources.jar.md5 +0 -1
  47. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96-sources.jar.sha1 +0 -1
  48. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96-sources.jar.sha256 +0 -1
  49. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96-sources.jar.sha512 +0 -1
  50. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar +0 -0
  51. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar.md5 +0 -1
  52. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar.sha1 +0 -1
  53. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar.sha256 +0 -1
  54. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar.sha512 +0 -1
  55. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.module.md5 +0 -1
  56. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.module.sha1 +0 -1
  57. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.module.sha256 +0 -1
  58. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.module.sha512 +0 -1
  59. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.pom.md5 +0 -1
  60. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.pom.sha1 +0 -1
  61. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.pom.sha256 +0 -1
  62. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.1.0-canary-20250919-7a31b96/expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.pom.sha512 +0 -1
  63. /package/android/src/main/{java/expo/modules/filesystem/AndroidManifest.xml → AndroidManifest.xml} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,10 +6,14 @@
6
6
 
7
7
  ### 🎉 New features
8
8
 
9
+ - Add write options for base64 encoded bytes. ([#39963](https://github.com/expo/expo/pull/39963) by [@aleqsio](https://github.com/aleqsio))
9
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
 
15
19
  ## 19.0.14 — 2025-09-13
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '19.1.0-canary-20250919-7a31b96'
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-20250919-7a31b96"
13
+ versionName "19.1.0-canary-20250930-9dc59d3"
14
14
  }
15
15
  }
16
16
 
@@ -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,6 +27,7 @@ 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")
@@ -138,10 +142,14 @@ class FileSystemModule : Module() {
138
142
  file.create(options ?: CreateOptions())
139
143
  }
140
144
 
141
- Function("write") { file: FileSystemFile, content: Either<String, TypedArray> ->
145
+ Function("write") { file: FileSystemFile, content: Either<String, TypedArray>, options: WriteOptions? ->
142
146
  if (content.`is`(String::class)) {
143
147
  content.get(String::class).let {
144
- file.write(it)
148
+ if (options?.encoding == EncodingType.BASE64) {
149
+ file.write(Base64.decode(it, Base64.DEFAULT))
150
+ } else {
151
+ file.write(it)
152
+ }
145
153
  }
146
154
  }
147
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
@@ -17,6 +18,16 @@ data class CreateOptions(
17
18
  val idempotent: Boolean = false
18
19
  ) : Record
19
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
29
+ ) : Record
30
+
20
31
  data class DownloadOptions(
21
32
  @Field
22
33
  val headers: Map<String, String> = emptyMap(),
@@ -10,6 +10,23 @@ export type FileCreateOptions = {
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
+ };
13
30
  export type DirectoryCreateOptions = {
14
31
  /**
15
32
  * Whether to create intermediate directories if they do not exist.
@@ -167,7 +184,7 @@ export declare class File {
167
184
  * Retrieves content of the file as base64.
168
185
  * @returns A promise that resolves with the contents of the file as a base64 string.
169
186
  */
170
- base64(): string;
187
+ base64(): Promise<string>;
171
188
  /**
172
189
  * Retrieves content of the file as base64.
173
190
  * @returns The contents of the file as a base64 string.
@@ -175,19 +192,19 @@ export declare class File {
175
192
  base64Sync(): string;
176
193
  /**
177
194
  * Retrieves byte content of the entire file.
178
- * @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`.
179
196
  */
180
197
  bytes(): Promise<Uint8Array<ArrayBuffer>>;
181
198
  /**
182
199
  * Retrieves byte content of the entire file.
183
- * @returns A promise that resolves with the contents of the file as a Uint8Array.
200
+ * @returns The contents of the file as a `Uint8Array`.
184
201
  */
185
202
  bytesSync(): Uint8Array;
186
203
  /**
187
204
  * Writes content to the file.
188
205
  * @param content The content to write into the file.
189
206
  */
190
- write(content: string | Uint8Array): void;
207
+ write(content: string | Uint8Array, options: FileWriteOptions): void;
191
208
  /**
192
209
  * Deletes a file.
193
210
  *
@@ -231,10 +248,18 @@ export declare class File {
231
248
  /**
232
249
  * A static method that downloads a file from the network.
233
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
+ *
234
256
  * @param url - The URL of the file to download.
235
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.
236
259
  *
237
- * @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.
238
263
  *
239
264
  * @example
240
265
  * ```ts
@@ -249,7 +274,7 @@ export declare class File {
249
274
  *
250
275
  * @param initialUri An optional URI pointing to an initial folder on which the file picker is opened.
251
276
  * @param mimeType A mime type that is used to filter out files that can be picked out.
252
- * @returns a `File` instance or an array of `File` instances.
277
+ * @returns A `File` instance or an array of `File` instances.
253
278
  */
254
279
  static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File | File[]>;
255
280
  /**
@@ -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;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,IAAI;IAE9C,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAEvD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;IAExC;;OAEG;IACH,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,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,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB;;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,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"}
@@ -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,4 +1,4 @@
1
1
  export * from './FileSystem';
2
- export { type FileCreateOptions, type DirectoryCreateOptions, 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
3
  export * from './legacyWarnings';
4
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;AAEhC,cAAc,kBAAkB,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"}
@@ -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-20250919-7a31b96",
15
+ "version": "19.1.0-canary-20250930-9dc59d3",
16
16
  "repository": "local-maven-repo"
17
17
  }
18
18
  }
@@ -13,6 +13,12 @@ internal final class UnableToDownloadException: GenericException<String> {
13
13
  }
14
14
  }
15
15
 
16
+ internal final class UnableToWriteBase64DataException: GenericException<String> {
17
+ override var reason: String {
18
+ "Unable to write base64 data to a file: \(param)"
19
+ }
20
+ }
21
+
16
22
  internal final class InvalidTypeFileException: Exception {
17
23
  override var reason: String {
18
24
  "A folder with the same name already exists in the file location"
@@ -81,6 +81,12 @@ internal final class FileSystemFile: FileSystemPath {
81
81
  }
82
82
  }
83
83
 
84
+ func write(_ data: Data) throws {
85
+ try withCorrectTypeAndScopedAccess(permission: .write) {
86
+ try data.write(to: url)
87
+ }
88
+ }
89
+
84
90
  // TODO: blob support
85
91
  func write(_ content: TypedArray) throws {
86
92
  try withCorrectTypeAndScopedAccess(permission: .write) {
@@ -202,9 +202,16 @@ public final class FileSystemModule: Module {
202
202
  return try file.info(options: options ?? InfoOptions())
203
203
  }
204
204
 
205
- Function("write") { (file, content: Either<String, TypedArray>) in
205
+ Function("write") { (file: FileSystemFile, content: Either<String, TypedArray>, options: WriteOptions?) in
206
206
  if let content: String = content.get() {
207
- try file.write(content)
207
+ if options?.encoding == WriteEncoding.base64 {
208
+ guard let data = Data(base64Encoded: content, options: .ignoreUnknownCharacters) else {
209
+ throw UnableToWriteBase64DataException(file.url.absoluteString)
210
+ }
211
+ try file.write(data)
212
+ } else {
213
+ try file.write(content)
214
+ }
208
215
  }
209
216
  if let content: TypedArray = content.get() {
210
217
  try file.write(content)
@@ -35,3 +35,12 @@ struct DirectoryInfo: Record {
35
35
  @Field var modificationTime: Int64?
36
36
  @Field var creationTime: Int64?
37
37
  }
38
+
39
+ enum WriteEncoding: String, Enumerable {
40
+ case utf8
41
+ case base64
42
+ }
43
+
44
+ struct WriteOptions: Record {
45
+ @Field var encoding: WriteEncoding?
46
+ }
@@ -0,0 +1 @@
1
+ 60c1582dab4e6504250846af398e2e5993b17a7c14c141282407f8f7f7949256331d238c5ea32afb7c5753903fc0b868fe1a79c3f972ea2525e947744005c6dc
@@ -0,0 +1 @@
1
+ c06237b0df153d84f847eec9d3b9a677605a639191980b6d38b58a42d98a8e56bd0cbed3e22cbc956ee27709abe0ff44f77750b961377b845510b093fef6a546
@@ -3,14 +3,14 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.filesystem",
6
- "version": "19.1.0-canary-20250919-7a31b96",
6
+ "version": "19.1.0-canary-20250930-9dc59d3",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
10
10
  },
11
11
  "createdBy": {
12
12
  "gradle": {
13
- "version": "8.14.3"
13
+ "version": "9.0.0"
14
14
  }
15
15
  },
16
16
  "variants": [
@@ -75,13 +75,13 @@
75
75
  ],
76
76
  "files": [
77
77
  {
78
- "name": "expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar",
79
- "url": "expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar",
80
- "size": 386747,
81
- "sha512": "acbe861a908142be88eae95809a80e51574b5a70c980bc45fa0c1c634972e7ee98ca03d9286e6a2aca0b9b2764e3e92e4f484472a587e9330f1cf9efb3b866a9",
82
- "sha256": "38db39dc4425a365524ef25cca51740a6c671970a34c27bc8da80ad7ef853a97",
83
- "sha1": "795f2aa667934af20b277058a973e66e567aabd5",
84
- "md5": "65a90c8c307beb7e905d5d1b87f47f71"
78
+ "name": "expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar",
79
+ "url": "expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar",
80
+ "size": 390234,
81
+ "sha512": "c06237b0df153d84f847eec9d3b9a677605a639191980b6d38b58a42d98a8e56bd0cbed3e22cbc956ee27709abe0ff44f77750b961377b845510b093fef6a546",
82
+ "sha256": "ddc92ee79897052fc6df29460ca06ec69c13f347946bd4ecfbcd54358a65ff33",
83
+ "sha1": "6c8de52d70ec473c90b7d31a92cf34950d748780",
84
+ "md5": "4149892f97989d0e3c81edb204b11142"
85
85
  }
86
86
  ]
87
87
  },
@@ -153,13 +153,13 @@
153
153
  ],
154
154
  "files": [
155
155
  {
156
- "name": "expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar",
157
- "url": "expo.modules.filesystem-19.1.0-canary-20250919-7a31b96.aar",
158
- "size": 386747,
159
- "sha512": "acbe861a908142be88eae95809a80e51574b5a70c980bc45fa0c1c634972e7ee98ca03d9286e6a2aca0b9b2764e3e92e4f484472a587e9330f1cf9efb3b866a9",
160
- "sha256": "38db39dc4425a365524ef25cca51740a6c671970a34c27bc8da80ad7ef853a97",
161
- "sha1": "795f2aa667934af20b277058a973e66e567aabd5",
162
- "md5": "65a90c8c307beb7e905d5d1b87f47f71"
156
+ "name": "expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar",
157
+ "url": "expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3.aar",
158
+ "size": 390234,
159
+ "sha512": "c06237b0df153d84f847eec9d3b9a677605a639191980b6d38b58a42d98a8e56bd0cbed3e22cbc956ee27709abe0ff44f77750b961377b845510b093fef6a546",
160
+ "sha256": "ddc92ee79897052fc6df29460ca06ec69c13f347946bd4ecfbcd54358a65ff33",
161
+ "sha1": "6c8de52d70ec473c90b7d31a92cf34950d748780",
162
+ "md5": "4149892f97989d0e3c81edb204b11142"
163
163
  }
164
164
  ]
165
165
  },
@@ -173,13 +173,13 @@
173
173
  },
174
174
  "files": [
175
175
  {
176
- "name": "expo.modules.filesystem-19.1.0-canary-20250919-7a31b96-sources.jar",
177
- "url": "expo.modules.filesystem-19.1.0-canary-20250919-7a31b96-sources.jar",
178
- "size": 28571,
179
- "sha512": "5e896d6a549d64430a226c22eb689f3d84f088506657d2985750534e5840f17b1c903a4fee9cd9a915f47a3e6773596b1f33bd388570e9f4fd360ac2d5d54521",
180
- "sha256": "243397e0d8c3e68d5bce371d9a1ac30805c8b93e4f2940d0ddb312d5056ef292",
181
- "sha1": "8de8a89b5e329ae1f0989a09d1fc13fe6b672fb5",
182
- "md5": "e4ed87add3090ef9b1f273d33bc37969"
176
+ "name": "expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar",
177
+ "url": "expo.modules.filesystem-19.1.0-canary-20250930-9dc59d3-sources.jar",
178
+ "size": 28785,
179
+ "sha512": "60c1582dab4e6504250846af398e2e5993b17a7c14c141282407f8f7f7949256331d238c5ea32afb7c5753903fc0b868fe1a79c3f972ea2525e947744005c6dc",
180
+ "sha256": "2ce5bf618d3e1370e92da41b3ae54847ee10874310bac1c7a31918ea9b463777",
181
+ "sha1": "d372fc4ea514b436e89656c186c54f3c27320b7e",
182
+ "md5": "eb9c254f5ab2514e83db9dd934eaa22c"
183
183
  }
184
184
  ]
185
185
  }
@@ -0,0 +1 @@
1
+ 2b92a2b6253b9792d3dd56266e68e175db78668e71d9ff48074d014d85523c51d45283ab6f3fefcaeae00239a102de61346a5fde6e1db69463dfe0e939ce5b5b
@@ -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.1.0-canary-20250919-7a31b96</version>
12
+ <version>19.1.0-canary-20250930-9dc59d3</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
+ 184f7cb289671255cfd98d73b6777aa5186c06e96da3cbf9c6ff2e9c82daf7d4f3ee88fc75b311a7368ae9e327c9488fb855a96353d885d2590e6d76b58f8bca
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.filesystem</artifactId>
5
5
  <versioning>
6
- <latest>19.1.0-canary-20250919-7a31b96</latest>
7
- <release>19.1.0-canary-20250919-7a31b96</release>
6
+ <latest>19.1.0-canary-20250930-9dc59d3</latest>
7
+ <release>19.1.0-canary-20250930-9dc59d3</release>
8
8
  <versions>
9
- <version>19.1.0-canary-20250919-7a31b96</version>
9
+ <version>19.1.0-canary-20250930-9dc59d3</version>
10
10
  </versions>
11
- <lastUpdated>20250919195357</lastUpdated>
11
+ <lastUpdated>20250930162534</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 9b064eb175b3ba4a8bfe3822d3f9d43a
1
+ 6d2fbfe4ba49c277946cc600b92a9549
@@ -1 +1 @@
1
- 184640b9b65ddd8e51200827bf267f2a0ab405bb
1
+ 8f360d07c11fbc7e29d014d0cdbad4a11735fa02
@@ -1 +1 @@
1
- 1cedddeb68e1d68ac0d4c9dbee942031c55710c73c74da1edba5fd6b93afaa14
1
+ 2464535b58a6f050f8e5547a579684dc4fffa3157c2de437b60a562d22e3e8aa
@@ -1 +1 @@
1
- 8b70e296848f602599d4c06111b237371406a5d439f68dcc486585d04e3ee42cf981dfc95cf423283c21f0036168462f3cc5c2b311afe1b20fcbea38699c5028
1
+ ab2ddd2374eb24ec4515ca95e581cb74ff08d5cd664df96e231df030b61cefd6417f8f89bea54a18b79cb8d2e7d2bc61bcb44428d76ccb777feccc017825bf98
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-file-system",
3
- "version": "19.1.0-canary-20250919-7a31b96",
3
+ "version": "19.1.0-canary-20250930-9dc59d3",
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,11 +35,11 @@
35
35
  "preset": "expo-module-scripts"
36
36
  },
37
37
  "devDependencies": {
38
- "expo-module-scripts": "5.0.8-canary-20250919-7a31b96",
39
- "jest-expo": "55.0.0-canary-20250919-7a31b96"
38
+ "expo-module-scripts": "5.0.8-canary-20250930-9dc59d3",
39
+ "jest-expo": "55.0.0-canary-20250930-9dc59d3"
40
40
  },
41
41
  "peerDependencies": {
42
- "expo": "55.0.0-canary-20250919-7a31b96",
42
+ "expo": "55.0.0-canary-20250930-9dc59d3",
43
43
  "react-native": "*"
44
44
  }
45
45
  }
@@ -11,6 +11,25 @@ export type FileCreateOptions = {
11
11
  overwrite?: boolean;
12
12
  };
13
13
 
14
+ export enum EncodingType {
15
+ /**
16
+ * Standard encoding format.
17
+ */
18
+ UTF8 = 'utf8',
19
+ /**
20
+ * Binary, radix-64 representation.
21
+ */
22
+ Base64 = 'base64',
23
+ }
24
+
25
+ export type FileWriteOptions = {
26
+ /**
27
+ * The encoding format to use when writing the file.
28
+ * @default FileSystem.EncodingType.UTF8
29
+ */
30
+ encoding?: EncodingType | 'utf8' | 'base64';
31
+ };
32
+
14
33
  export type DirectoryCreateOptions = {
15
34
  /**
16
35
  * Whether to create intermediate directories if they do not exist.
@@ -188,7 +207,7 @@ export declare class File {
188
207
  * Retrieves content of the file as base64.
189
208
  * @returns A promise that resolves with the contents of the file as a base64 string.
190
209
  */
191
- base64(): string;
210
+ base64(): Promise<string>;
192
211
 
193
212
  /**
194
213
  * Retrieves content of the file as base64.
@@ -198,13 +217,13 @@ export declare class File {
198
217
 
199
218
  /**
200
219
  * Retrieves byte content of the entire file.
201
- * @returns A promise that resolves with the contents of the file as a Uint8Array.
220
+ * @returns A promise that resolves with the contents of the file as a `Uint8Array`.
202
221
  */
203
222
  bytes(): Promise<Uint8Array<ArrayBuffer>>;
204
223
 
205
224
  /**
206
225
  * Retrieves byte content of the entire file.
207
- * @returns A promise that resolves with the contents of the file as a Uint8Array.
226
+ * @returns The contents of the file as a `Uint8Array`.
208
227
  */
209
228
  bytesSync(): Uint8Array;
210
229
 
@@ -212,7 +231,7 @@ export declare class File {
212
231
  * Writes content to the file.
213
232
  * @param content The content to write into the file.
214
233
  */
215
- write(content: string | Uint8Array): void;
234
+ write(content: string | Uint8Array, options: FileWriteOptions): void;
216
235
 
217
236
  /**
218
237
  * Deletes a file.
@@ -265,10 +284,18 @@ export declare class File {
265
284
  /**
266
285
  * A static method that downloads a file from the network.
267
286
  *
287
+ * On Android, the response body streams directly into the target file. If the download fails after
288
+ * it starts, a partially written file may remain at the destination. On iOS, the download first
289
+ * completes in a temporary location and the file is moved into place only after success, so no
290
+ * file is left behind when the request fails.
291
+ *
268
292
  * @param url - The URL of the file to download.
269
293
  * @param destination - The destination directory or file. If a directory is provided, the resulting filename will be determined based on the response headers.
294
+ * @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.
270
295
  *
271
- * @returns A promise that resolves to the downloaded file.
296
+ * @returns A promise that resolves to the downloaded file. When the server responds with
297
+ * a non-2xx HTTP status, the promise rejects with an `UnableToDownload` error whose
298
+ * message includes the status code. No file is created in that scenario.
272
299
  *
273
300
  * @example
274
301
  * ```ts
@@ -288,7 +315,7 @@ export declare class File {
288
315
  *
289
316
  * @param initialUri An optional URI pointing to an initial folder on which the file picker is opened.
290
317
  * @param mimeType A mime type that is used to filter out files that can be picked out.
291
- * @returns a `File` instance or an array of `File` instances.
318
+ * @returns A `File` instance or an array of `File` instances.
292
319
  */
293
320
  static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File | File[]>;
294
321
 
package/src/FileSystem.ts CHANGED
@@ -65,7 +65,7 @@ export class Paths extends PathUtilities {
65
65
  * 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).
66
66
  * @example
67
67
  * ```ts
68
- * const file = new File(File.cache, "subdirName", "file.txt");
68
+ * const file = new File(Paths.cache, "subdirName", "file.txt");
69
69
  * ```
70
70
  */
71
71
  export class File extends ExpoFileSystem.FileSystemFile implements Blob {
@@ -76,7 +76,7 @@ export class File extends ExpoFileSystem.FileSystemFile implements Blob {
76
76
  * @param uris An array of: `file:///` string URIs, `File` instances, and `Directory` instances representing an arbitrary location on the file system.
77
77
  * @example
78
78
  * ```ts
79
- * const file = new File(File.cache, "subdirName", "file.txt");
79
+ * const file = new File(Paths.cache, "subdirName", "file.txt");
80
80
  * ```
81
81
  */
82
82
  constructor(...uris: (string | File | Directory)[]) {
@@ -151,7 +151,7 @@ File.pickFileAsync = async function (initialUri?: string, mimeType?: string) {
151
151
  * 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`).
152
152
  * @example
153
153
  * ```ts
154
- * const directory = new Directory(File.cache, "subdirName");
154
+ * const directory = new Directory(Paths.cache, "subdirName");
155
155
  * ```
156
156
  */
157
157
  export class Directory extends ExpoFileSystem.FileSystemDirectory {
@@ -162,7 +162,7 @@ export class Directory extends ExpoFileSystem.FileSystemDirectory {
162
162
  * @param uris An array of: `file:///` string URIs, `File` instances, and `Directory` instances representing an arbitrary location on the file system.
163
163
  * @example
164
164
  * ```ts
165
- * const directory = new Directory(File.cache, "subdirName");
165
+ * const directory = new Directory(Paths.cache, "subdirName");
166
166
  * ```
167
167
  */
168
168
  constructor(...uris: (string | File | Directory)[]) {
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export {
8
8
  type InfoOptions,
9
9
  type PathInfo,
10
10
  type DirectoryInfo,
11
+ type DownloadOptions,
11
12
  } from './ExpoFileSystem.types';
12
13
 
13
14
  export * from './legacyWarnings';
@@ -1 +0,0 @@
1
- 5e896d6a549d64430a226c22eb689f3d84f088506657d2985750534e5840f17b1c903a4fee9cd9a915f47a3e6773596b1f33bd388570e9f4fd360ac2d5d54521
@@ -1 +0,0 @@
1
- acbe861a908142be88eae95809a80e51574b5a70c980bc45fa0c1c634972e7ee98ca03d9286e6a2aca0b9b2764e3e92e4f484472a587e9330f1cf9efb3b866a9
@@ -1 +0,0 @@
1
- cdde4b39de1cf04ddc8335d727104f1db2c9d8d4d8b4116fbb488fc7c1d87c30cfcb41769eeb83942bf1a0de18d8ffc59ec3e4dedacec1162ddd2ee810392eb9
@@ -1 +0,0 @@
1
- ecc02b9a7f5764d040763ba156e6b2a68d5d5322610ca28d8e20740bc498e0fffcb5c4648d11b3d94889c2128089fab8a498727b86adf1e4146843e0d9fc311b