expo-file-system 19.0.6 → 19.0.7

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 (60) hide show
  1. package/CHANGELOG.md +7 -0
  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/FileSystemModule.kt +8 -0
  5. package/android/src/main/java/expo/modules/filesystem/FileSystemNextRecords.kt +3 -1
  6. package/android/src/main/java/expo/modules/filesystem/FileSystemPath.kt +14 -0
  7. package/build/ExpoFileSystem.types.d.ts +35 -5
  8. package/build/ExpoFileSystem.types.d.ts.map +1 -1
  9. package/build/index.d.ts +1 -1
  10. package/build/index.d.ts.map +1 -1
  11. package/expo-module.config.json +1 -1
  12. package/ios/FileSystemDirectory.swift +10 -0
  13. package/ios/FileSystemModule.swift +8 -0
  14. package/ios/FileSystemPath.swift +13 -0
  15. package/ios/FileSystemRecords.swift +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.6/expo.modules.filesystem-19.0.6-sources.jar → 19.0.7/expo.modules.filesystem-19.0.7-sources.jar} +0 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.md5 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.sha1 +1 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.sha256 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7-sources.jar.sha512 +1 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar +0 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.md5 +1 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.sha1 +1 -0
  24. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.sha256 +1 -0
  25. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.aar.sha512 +1 -0
  26. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.6/expo.modules.filesystem-19.0.6.module → 19.0.7/expo.modules.filesystem-19.0.7.module} +22 -22
  27. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.md5 +1 -0
  28. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.sha1 +1 -0
  29. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.sha256 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.module.sha512 +1 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.6/expo.modules.filesystem-19.0.6.pom → 19.0.7/expo.modules.filesystem-19.0.7.pom} +1 -1
  32. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.md5 +1 -0
  33. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.sha1 +1 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.sha256 +1 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.7/expo.modules.filesystem-19.0.7.pom.sha512 +1 -0
  36. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml +4 -4
  37. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.md5 +1 -1
  38. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha1 +1 -1
  39. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256 +1 -1
  40. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512 +1 -1
  41. package/package.json +4 -4
  42. package/src/ExpoFileSystem.types.ts +38 -5
  43. package/src/index.ts +2 -1
  44. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6-sources.jar.md5 +0 -1
  45. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6-sources.jar.sha1 +0 -1
  46. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6-sources.jar.sha256 +0 -1
  47. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6-sources.jar.sha512 +0 -1
  48. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.aar +0 -0
  49. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.aar.md5 +0 -1
  50. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.aar.sha1 +0 -1
  51. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.aar.sha256 +0 -1
  52. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.aar.sha512 +0 -1
  53. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.module.md5 +0 -1
  54. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.module.sha1 +0 -1
  55. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.module.sha256 +0 -1
  56. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.module.sha512 +0 -1
  57. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.pom.md5 +0 -1
  58. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.pom.sha1 +0 -1
  59. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.pom.sha256 +0 -1
  60. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.6/expo.modules.filesystem-19.0.6.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 19.0.7 — 2025-08-31
14
+
15
+ ### 🎉 New features
16
+
17
+ - Add `rename` method for files and directories ([#39138](https://github.com/expo/expo/pull/39138) by [@kosmydel](https://github.com/kosmydel))
18
+ - Add `idempotent` option for creating directories ([#39121](https://github.com/expo/expo/pull/39121) by [@kosmydel](https://github.com/kosmydel))
19
+
13
20
  ## 19.0.6 — 2025-08-26
14
21
 
15
22
  _This version does not introduce any user-facing changes._
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '19.0.6'
7
+ version = '19.0.7'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.filesystem"
11
11
  defaultConfig {
12
12
  versionCode 30
13
- versionName "19.0.6"
13
+ versionName "19.0.7"
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
  }
@@ -193,6 +193,10 @@ class FileSystemModule : Module() {
193
193
  file.move(destination)
194
194
  }
195
195
 
196
+ Function("rename") { file: FileSystemFile, newName: String ->
197
+ file.rename(newName)
198
+ }
199
+
196
200
  Property("uri") { file ->
197
201
  file.asString()
198
202
  }
@@ -286,6 +290,10 @@ class FileSystemModule : Module() {
286
290
  directory.move(destination)
287
291
  }
288
292
 
293
+ Function("rename") { directory: FileSystemDirectory, newName: String ->
294
+ directory.rename(newName)
295
+ }
296
+
289
297
  Property("uri") { directory ->
290
298
  directory.asString()
291
299
  }
@@ -12,7 +12,9 @@ data class CreateOptions(
12
12
  @Field
13
13
  val intermediates: Boolean = false,
14
14
  @Field
15
- val overwrite: Boolean = false
15
+ val overwrite: Boolean = false,
16
+ @Field
17
+ val idempotent: Boolean = false
16
18
  ) : Record
17
19
 
18
20
  data class DownloadOptions(
@@ -163,6 +163,20 @@ abstract class FileSystemPath(var uri: Uri) : SharedObject() {
163
163
  }
164
164
  }
165
165
 
166
+ fun rename(newName: String) {
167
+ validateType()
168
+ validatePermission(Permission.WRITE)
169
+ val newFile = File(javaFile.parent, newName)
170
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
171
+ javaFile.toPath().moveTo(newFile.toPath())
172
+ uri = newFile.toUri()
173
+ } else {
174
+ javaFile.copyTo(newFile)
175
+ javaFile.delete()
176
+ uri = newFile.toUri()
177
+ }
178
+ }
179
+
166
180
  val modificationTime: Long? get() {
167
181
  validateType()
168
182
  return file.lastModified()
@@ -1,15 +1,37 @@
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 type DirectoryCreateOptions = {
14
+ /**
15
+ * Whether to create intermediate directories if they do not exist.
16
+ * @default false
17
+ */
18
+ intermediates?: boolean;
19
+ /**
20
+ * Whether to overwrite the directory if it exists.
21
+ * @default false
22
+ */
23
+ overwrite?: boolean;
24
+ /**
25
+ * This flag controls whether the `create` operation is idempotent
26
+ * (safe to call multiple times without error).
27
+ *
28
+ * If `true`, creating a file or directory that already exists will succeed silently.
29
+ * If `false`, an error will be thrown when the target already exists.
30
+ *
31
+ * @default false
32
+ */
33
+ idempotent?: boolean;
34
+ };
13
35
  export declare class Directory {
14
36
  /**
15
37
  * Creates an instance of a directory.
@@ -42,9 +64,9 @@ export declare class Directory {
42
64
  /**
43
65
  * Creates a directory that the current uri points to.
44
66
  *
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.
67
+ * @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
68
  */
47
- create(options?: CreateOptions): void;
69
+ create(options?: DirectoryCreateOptions): void;
48
70
  createFile(name: string, mimeType: string | null): File;
49
71
  createDirectory(name: string): Directory;
50
72
  /**
@@ -55,6 +77,10 @@ export declare class Directory {
55
77
  * Moves a directory. Updates the `uri` property that now points to the new location.
56
78
  */
57
79
  move(destination: Directory | File): void;
80
+ /**
81
+ * Renames a directory.
82
+ */
83
+ rename(newName: string): void;
58
84
  /**
59
85
  * @hidden
60
86
  * Lists the contents of a directory. Should not be used directly, as it returns a list of paths.
@@ -172,7 +198,7 @@ export declare class File {
172
198
  *
173
199
  * @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.
174
200
  */
175
- create(options?: CreateOptions): void;
201
+ create(options?: FileCreateOptions): void;
176
202
  /**
177
203
  * Copies a file.
178
204
  */
@@ -181,6 +207,10 @@ export declare class File {
181
207
  * Moves a directory. Updates the `uri` property that now points to the new location.
182
208
  */
183
209
  move(destination: Directory | File): void;
210
+ /**
211
+ * Renames a file.
212
+ */
213
+ rename(newName: string): void;
184
214
  /**
185
215
  * Returns A `FileHandle` object that can be used to read and write data to the file.
186
216
  * @throws Error if the file does not exist or cannot be opened.
@@ -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,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,aAAa,GAAG,IAAI;IAErC,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,IAAI,GAAG,IAAI;IAEzC;;OAEG;IACH,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI,GAA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1B;;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,3 @@
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, } from './ExpoFileSystem.types';
3
3
  //# 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,GACnB,MAAM,wBAAwB,CAAC"}
@@ -12,7 +12,7 @@
12
12
  "publication": {
13
13
  "groupId": "host.exp.exponent",
14
14
  "artifactId": "expo.modules.filesystem",
15
- "version": "19.0.6",
15
+ "version": "19.0.7",
16
16
  "repository": "local-maven-repo"
17
17
  }
18
18
  }
@@ -19,6 +19,9 @@ internal final class FileSystemDirectory: FileSystemPath {
19
19
  func create(_ options: CreateOptions) throws {
20
20
  try validatePermission(.write)
21
21
  try validateType()
22
+ guard try needsCreation(options) else {
23
+ return
24
+ }
22
25
  try validateCanCreate(options)
23
26
  do {
24
27
  try FileManager.default.createDirectory(at: url, withIntermediateDirectories: options.intermediates, attributes: nil)
@@ -97,4 +100,11 @@ internal final class FileSystemDirectory: FileSystemPath {
97
100
  throw UnableToGetInfoException("url scheme \(String(describing: url.scheme)) is not supported")
98
101
  }
99
102
  }
103
+
104
+ func needsCreation(_ options: CreateOptions) throws -> Bool {
105
+ if !exists {
106
+ return true
107
+ }
108
+ return !options.idempotent
109
+ }
100
110
  }
@@ -208,6 +208,10 @@ public final class FileSystemModule: Module {
208
208
  try file.move(to: to)
209
209
  }
210
210
 
211
+ Function("rename") { (file, newName: String) in
212
+ try file.rename(newName)
213
+ }
214
+
211
215
  Property("uri") { file in
212
216
  return file.url.absoluteString
213
217
  }
@@ -272,6 +276,10 @@ public final class FileSystemModule: Module {
272
276
  try directory.move(to: to)
273
277
  }
274
278
 
279
+ Function("rename") { (directory, newName: String) in
280
+ try directory.rename(newName)
281
+ }
282
+
275
283
  // this function is internal and will be removed in the future (when returning arrays of shared objects is supported)
276
284
  Function("listAsRecords") { directory in
277
285
  try directory.listAsRecords()
@@ -76,6 +76,19 @@ internal class FileSystemPath: SharedObject {
76
76
  url = destinationUrl
77
77
  }
78
78
 
79
+ func getRenamedUrl(newName: String) -> URL {
80
+ return url.deletingLastPathComponent().appendingPathComponent(newName)
81
+ }
82
+
83
+ func rename(_ newName: String) throws {
84
+ try validatePermission(.write)
85
+ let newUrl = getRenamedUrl(newName: newName)
86
+ try FileManager.default.moveItem(at: url, to: newUrl)
87
+ // Refetch the URL to ensure it has the correct trailing slash, which differs for directories and files.
88
+ let updatedUrl = getRenamedUrl(newName: newName)
89
+ url = updatedUrl
90
+ }
91
+
79
92
  var modificationTime: Int64 {
80
93
  get throws {
81
94
  let modificationDate: Date = try getAttribute(.modificationDate, atPath: url.path)
@@ -5,6 +5,7 @@ import ExpoModulesCore
5
5
  struct CreateOptions: Record {
6
6
  @Field var intermediates: Bool = false
7
7
  @Field var overwrite: Bool = false
8
+ @Field var idempotent: Bool = false
8
9
  }
9
10
 
10
11
  struct DownloadOptions: Record {
@@ -0,0 +1 @@
1
+ d40b6af1ade1a3e62958afbeb12170073ec4b0e9171e20ba91cdb1e1ae1b04ac
@@ -0,0 +1 @@
1
+ 883e3e975a1c678ab873b0e1a009d6b2e047daf7e3a21a8444a848a6f67b93ede413ae71029d59732541d9aa7bd7c9067626b0fd70a13e1d428da0e1e5a3bd9d
@@ -0,0 +1 @@
1
+ 3b1f05d11977bd8acba506764a3ed15e1bc517e7aaec57112545923c8b81ab04
@@ -0,0 +1 @@
1
+ de4ccf9ef1c373a39e75d149e717061316cba471c546ad5247bc629083868d5e8700322898b147d22aa845fcd9e5f0ec1fca48c0d76025dddb41b3b300360627
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.filesystem",
6
- "version": "19.0.6",
6
+ "version": "19.0.7",
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.6.aar",
79
- "url": "expo.modules.filesystem-19.0.6.aar",
80
- "size": 373316,
81
- "sha512": "36dc7ab692103570111d72588e7674ae1c7cf2c0665a351738f87dc0af98dbccb34aef221f34b5630403f2d6fd46a13cd22e4b3fb75a90f6b8b0bc2a41dd49cf",
82
- "sha256": "977ef17ccaa7a6f8c09c70d2f2f2f0c1002f07df8b3756ce3905a37a7288b41b",
83
- "sha1": "7f26aacfe041259700988a8f2e865b6d78a47865",
84
- "md5": "67fb8fe6d438a03c9f9b1419f17a116d"
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"
85
85
  }
86
86
  ]
87
87
  },
@@ -153,13 +153,13 @@
153
153
  ],
154
154
  "files": [
155
155
  {
156
- "name": "expo.modules.filesystem-19.0.6.aar",
157
- "url": "expo.modules.filesystem-19.0.6.aar",
158
- "size": 373316,
159
- "sha512": "36dc7ab692103570111d72588e7674ae1c7cf2c0665a351738f87dc0af98dbccb34aef221f34b5630403f2d6fd46a13cd22e4b3fb75a90f6b8b0bc2a41dd49cf",
160
- "sha256": "977ef17ccaa7a6f8c09c70d2f2f2f0c1002f07df8b3756ce3905a37a7288b41b",
161
- "sha1": "7f26aacfe041259700988a8f2e865b6d78a47865",
162
- "md5": "67fb8fe6d438a03c9f9b1419f17a116d"
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"
163
163
  }
164
164
  ]
165
165
  },
@@ -173,13 +173,13 @@
173
173
  },
174
174
  "files": [
175
175
  {
176
- "name": "expo.modules.filesystem-19.0.6-sources.jar",
177
- "url": "expo.modules.filesystem-19.0.6-sources.jar",
178
- "size": 28421,
179
- "sha512": "c91977ae610fa808ea0765cd14182ad1d8961f59cbdf2df2396e7f77fe8cadbcd152018902a4f09474177b5ea77f78c107d6016c127d0546c4e9b0ebbf2b13fe",
180
- "sha256": "9cf826cfa827700e415e780bc1b4a49477ea31486d465154824b7331c89e9dc7",
181
- "sha1": "5f879a11258f3b3e06b575f71e801aab8e25113b",
182
- "md5": "8e4953080a31fa4851c0d3af21f5f2a8"
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"
183
183
  }
184
184
  ]
185
185
  }
@@ -0,0 +1 @@
1
+ df378e667196c0a9fb856d02a0a7d4b761d3975d0345a970338cc8fcf7c17bff
@@ -0,0 +1 @@
1
+ e9ef84e5f83b6e1705e1b5a7802682aec4f49c2f91a001291c9bdd79d1b1a71f51b9fa08b8204e1dc08522a9e0c6214288d4a8e87a1a1ac6806ccbcb08e038e7
@@ -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.6</version>
12
+ <version>19.0.7</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
+ 711ea03d039b3c3ceabdc4f9de6d3c45fa054f5892763c708de0e416135e7b41
@@ -0,0 +1 @@
1
+ 9ce4435eef9347f5860fce84c95feca14bf7746d4d6ed079f27c25ab77bc1b3249a8df72ea4c946c8200efdc4cebd38573fef10fb9bf931512e0e5de2a19c6ab
@@ -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.6</latest>
7
- <release>19.0.6</release>
6
+ <latest>19.0.7</latest>
7
+ <release>19.0.7</release>
8
8
  <versions>
9
- <version>19.0.6</version>
9
+ <version>19.0.7</version>
10
10
  </versions>
11
- <lastUpdated>20250826172804</lastUpdated>
11
+ <lastUpdated>20250831124212</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- c14c2616f065148d676957ac2daec817
1
+ dcab33e619a12cb1280ed5526609c42d
@@ -1 +1 @@
1
- 916672a04fb5d9ab23c2ea10835d120c7d0d4457
1
+ 238a976822d6a261fa7f76460d534d4f5934233f
@@ -1 +1 @@
1
- 2035f9bd454ad732e2fc1524d4821cbe3c2dc27cfede9a10a80ad5dea96b1697
1
+ 3693e2c2f2b219f586d17150a2433838d437328d308c677cbcb50d8d5da61709
@@ -1 +1 @@
1
- f5abcdea24e961a071ba75c5e5f49decbb1c8082a5d38b48ba59be97c24feb8fd182aed8ca90c6653c6bef553dde35744035433ee875570202ea16b2a45c719b
1
+ 3959d1f0b20eec078018d1dbc67f436883b499575c2b2175e940500c8e822e569509a3b0f7141f4d3c772b0816d22d0bdf9c5993fb110983f8be35f8c7f195dc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-file-system",
3
- "version": "19.0.6",
3
+ "version": "19.0.7",
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.4",
39
- "jest-expo": "~54.0.4"
38
+ "expo-module-scripts": "^5.0.5",
39
+ "jest-expo": "~54.0.5"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "expo": "*",
43
43
  "react-native": "*"
44
44
  },
45
- "gitHead": "d44e41c9c0714a838b1652556d27bcb506fabbdf"
45
+ "gitHead": "1dafdaa317c182191909a94a355c8b08a2654783"
46
46
  }
@@ -1,16 +1,39 @@
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
13
 
14
+ export type DirectoryCreateOptions = {
15
+ /**
16
+ * Whether to create intermediate directories if they do not exist.
17
+ * @default false
18
+ */
19
+ intermediates?: boolean;
20
+ /**
21
+ * Whether to overwrite the directory if it exists.
22
+ * @default false
23
+ */
24
+ overwrite?: boolean;
25
+ /**
26
+ * This flag controls whether the `create` operation is idempotent
27
+ * (safe to call multiple times without error).
28
+ *
29
+ * If `true`, creating a file or directory that already exists will succeed silently.
30
+ * If `false`, an error will be thrown when the target already exists.
31
+ *
32
+ * @default false
33
+ */
34
+ idempotent?: boolean;
35
+ };
36
+
14
37
  export declare class Directory {
15
38
  /**
16
39
  * Creates an instance of a directory.
@@ -48,9 +71,9 @@ export declare class Directory {
48
71
  /**
49
72
  * Creates a directory that the current uri points to.
50
73
  *
51
- * @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.
74
+ * @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`).
52
75
  */
53
- create(options?: CreateOptions): void;
76
+ create(options?: DirectoryCreateOptions): void;
54
77
 
55
78
  createFile(name: string, mimeType: string | null): File;
56
79
 
@@ -66,6 +89,11 @@ export declare class Directory {
66
89
  */
67
90
  move(destination: Directory | File): void;
68
91
 
92
+ /**
93
+ * Renames a directory.
94
+ */
95
+ rename(newName: string): void;
96
+
69
97
  /**
70
98
  * @hidden
71
99
  * Lists the contents of a directory. Should not be used directly, as it returns a list of paths.
@@ -199,7 +227,7 @@ export declare class File {
199
227
  *
200
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.
201
229
  */
202
- create(options?: CreateOptions): void;
230
+ create(options?: FileCreateOptions): void;
203
231
 
204
232
  /**
205
233
  * Copies a file.
@@ -211,6 +239,11 @@ export declare class File {
211
239
  */
212
240
  move(destination: Directory | File): void;
213
241
 
242
+ /**
243
+ * Renames a file.
244
+ */
245
+ rename(newName: string): void;
246
+
214
247
  /**
215
248
  * Returns A `FileHandle` object that can be used to read and write data to the file.
216
249
  * @throws Error if the file does not exist or cannot be opened.
package/src/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export * from './FileSystem';
2
2
 
3
3
  export {
4
- type CreateOptions,
4
+ type FileCreateOptions,
5
+ type DirectoryCreateOptions,
5
6
  type FileHandle,
6
7
  type FileInfo,
7
8
  type InfoOptions,
@@ -1 +0,0 @@
1
- 9cf826cfa827700e415e780bc1b4a49477ea31486d465154824b7331c89e9dc7
@@ -1 +0,0 @@
1
- c91977ae610fa808ea0765cd14182ad1d8961f59cbdf2df2396e7f77fe8cadbcd152018902a4f09474177b5ea77f78c107d6016c127d0546c4e9b0ebbf2b13fe
@@ -1 +0,0 @@
1
- 977ef17ccaa7a6f8c09c70d2f2f2f0c1002f07df8b3756ce3905a37a7288b41b
@@ -1 +0,0 @@
1
- 36dc7ab692103570111d72588e7674ae1c7cf2c0665a351738f87dc0af98dbccb34aef221f34b5630403f2d6fd46a13cd22e4b3fb75a90f6b8b0bc2a41dd49cf
@@ -1 +0,0 @@
1
- 30cd879db3d67a93bbb86483e0e47f54a109f1e4dfbb33c2726401c737503b44
@@ -1 +0,0 @@
1
- d901e0bd5c6391eb748e76ad90a69263c236f8c87d1e8e23b5852d09803e4db69e96b909177165c6869b3d0decc843e1daab4d61a93fa17bda56964588e9545b
@@ -1 +0,0 @@
1
- fa1bdccedadabacbd2a0c6bc51aa70233255f74486b3c6b99e99829e58973760
@@ -1 +0,0 @@
1
- 91daccf5e4bfef06a91de0573936e5d637bd29472ece40112290d9cc5d65bc545d8adc3070662fefc4140d51eeddc09b6ff64b5403476a1c750cfb173273f6bd