expo-file-system 55.0.4 → 55.0.5
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.
- package/CHANGELOG.md +6 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/filesystem/FileSystemFile.kt +8 -8
- package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +4 -3
- package/android/src/main/java/expo/modules/filesystem/FileSystemNextRecords.kt +3 -1
- package/android/src/main/java/expo/modules/filesystem/legacy/FileSystemLegacyModule.kt +5 -4
- package/android/src/main/java/expo/modules/filesystem/legacy/FileSystemRecords.kt +3 -1
- package/android/src/main/java/expo/modules/filesystem/unifiedfile/AssetFile.kt +1 -1
- package/android/src/main/java/expo/modules/filesystem/unifiedfile/JavaFile.kt +2 -2
- package/android/src/main/java/expo/modules/filesystem/unifiedfile/SAFDocumentFile.kt +4 -3
- package/android/src/main/java/expo/modules/filesystem/unifiedfile/UnifiedFileInterface.kt +1 -1
- package/build/ExpoFileSystem.types.d.ts +5 -0
- package/build/ExpoFileSystem.types.d.ts.map +1 -1
- package/build/legacy/FileSystem.types.d.ts +5 -0
- package/build/legacy/FileSystem.types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/FileSystemFile.swift +32 -6
- package/ios/FileSystemModule.swift +4 -3
- package/ios/FileSystemRecords.swift +1 -0
- package/ios/Legacy/FileSystemLegacyModule.swift +23 -3
- package/ios/Legacy/FileSystemLegacyRecords.swift +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{55.0.4/expo.modules.filesystem-55.0.4.module → 55.0.5/expo.modules.filesystem-55.0.5.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{55.0.4/expo.modules.filesystem-55.0.4.pom → 55.0.5/expo.modules.filesystem-55.0.5.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.5/expo.modules.filesystem-55.0.5.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/src/ExpoFileSystem.types.ts +5 -0
- package/src/legacy/FileSystem.types.ts +5 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/55.0.4/expo.modules.filesystem-55.0.4.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 55.0.5 — 2026-02-08
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Add `append` option to write methods. ([#42778](https://github.com/expo/expo/pull/42778) by [@aleqsio](https://github.com/aleqsio))
|
|
18
|
+
|
|
13
19
|
## 55.0.4 — 2026-02-03
|
|
14
20
|
|
|
15
21
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -50,48 +50,48 @@ class FileSystemFile(uri: Uri) : FileSystemPath(uri) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
fun write(content: String) {
|
|
53
|
+
fun write(content: String, append: Boolean = false) {
|
|
54
54
|
validateType()
|
|
55
55
|
validatePermission(Permission.WRITE)
|
|
56
56
|
if (!exists) {
|
|
57
57
|
create()
|
|
58
58
|
}
|
|
59
|
-
file.outputStream().use { outputStream ->
|
|
59
|
+
file.outputStream(append).use { outputStream ->
|
|
60
60
|
outputStream.write(content.toByteArray())
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
fun write(content: TypedArray) {
|
|
64
|
+
fun write(content: TypedArray, append: Boolean = false) {
|
|
65
65
|
validateType()
|
|
66
66
|
validatePermission(Permission.WRITE)
|
|
67
67
|
if (!exists) {
|
|
68
68
|
create()
|
|
69
69
|
}
|
|
70
70
|
if (uri.isContentUri) {
|
|
71
|
-
file.outputStream().use { outputStream ->
|
|
71
|
+
file.outputStream(append).use { outputStream ->
|
|
72
72
|
val array = ByteArray(content.length)
|
|
73
73
|
content.toDirectBuffer().get(array)
|
|
74
74
|
outputStream.write(array)
|
|
75
75
|
}
|
|
76
76
|
} else {
|
|
77
|
-
FileOutputStream(javaFile).use {
|
|
77
|
+
FileOutputStream(javaFile, append).use {
|
|
78
78
|
it.channel.write(content.toDirectBuffer())
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
fun write(content: ByteArray) {
|
|
83
|
+
fun write(content: ByteArray, append: Boolean = false) {
|
|
84
84
|
validateType()
|
|
85
85
|
validatePermission(Permission.WRITE)
|
|
86
86
|
if (!exists) {
|
|
87
87
|
create()
|
|
88
88
|
}
|
|
89
89
|
if (uri.isContentUri) {
|
|
90
|
-
file.outputStream().use { outputStream ->
|
|
90
|
+
file.outputStream(append).use { outputStream ->
|
|
91
91
|
outputStream.write(content)
|
|
92
92
|
}
|
|
93
93
|
} else {
|
|
94
|
-
FileOutputStream(javaFile).use {
|
|
94
|
+
FileOutputStream(javaFile, append).use {
|
|
95
95
|
it.write(content)
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -150,18 +150,19 @@ class FileSystemModule : Module() {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
Function("write") { file: FileSystemFile, content: Either<String, TypedArray>, options: WriteOptions? ->
|
|
153
|
+
val append = options?.append ?: false
|
|
153
154
|
if (content.`is`(String::class)) {
|
|
154
155
|
content.get(String::class).let {
|
|
155
156
|
if (options?.encoding == EncodingType.BASE64) {
|
|
156
|
-
file.write(Base64.decode(it, Base64.DEFAULT))
|
|
157
|
+
file.write(Base64.decode(it, Base64.DEFAULT), append)
|
|
157
158
|
} else {
|
|
158
|
-
file.write(it)
|
|
159
|
+
file.write(it, append)
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
if (content.`is`(TypedArray::class)) {
|
|
163
164
|
content.get(TypedArray::class).let {
|
|
164
|
-
file.write(it)
|
|
165
|
+
file.write(it, append)
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
}
|
|
@@ -25,7 +25,9 @@ enum class EncodingType(val value: String) : Enumerable {
|
|
|
25
25
|
|
|
26
26
|
data class WriteOptions(
|
|
27
27
|
@Field
|
|
28
|
-
val encoding: EncodingType = EncodingType.UTF8
|
|
28
|
+
val encoding: EncodingType = EncodingType.UTF8,
|
|
29
|
+
@Field
|
|
30
|
+
val append: Boolean = false
|
|
29
31
|
) : Record
|
|
30
32
|
|
|
31
33
|
data class DownloadOptions(
|
|
@@ -210,7 +210,8 @@ open class FileSystemLegacyModule : Module() {
|
|
|
210
210
|
val uri = Uri.parse(slashifyFilePath(uriStr))
|
|
211
211
|
ensurePermission(uri, Permission.WRITE)
|
|
212
212
|
val encoding = options.encoding
|
|
213
|
-
|
|
213
|
+
val append = options.append
|
|
214
|
+
getOutputStream(uri, append).use { out ->
|
|
214
215
|
if (encoding == EncodingType.BASE64) {
|
|
215
216
|
val bytes = Base64.decode(contents, Base64.DEFAULT)
|
|
216
217
|
out.write(bytes)
|
|
@@ -1068,9 +1069,9 @@ open class FileSystemLegacyModule : Module() {
|
|
|
1068
1069
|
}
|
|
1069
1070
|
|
|
1070
1071
|
@Throws(IOException::class)
|
|
1071
|
-
private fun getOutputStream(uri: Uri) = when {
|
|
1072
|
-
uri.scheme == "file" -> FileOutputStream(uri.toFile())
|
|
1073
|
-
uri.isSAFUri -> context.contentResolver.openOutputStream(uri)!!
|
|
1072
|
+
private fun getOutputStream(uri: Uri, append: Boolean = false) = when {
|
|
1073
|
+
uri.scheme == "file" -> FileOutputStream(uri.toFile(), append)
|
|
1074
|
+
uri.isSAFUri -> context.contentResolver.openOutputStream(uri, if (append) "wa" else "w")!!
|
|
1074
1075
|
else -> throw IOException("Unsupported scheme for location '$uri'.")
|
|
1075
1076
|
}
|
|
1076
1077
|
|
|
@@ -63,7 +63,9 @@ data class DownloadOptionsLegacy(
|
|
|
63
63
|
|
|
64
64
|
data class WritingOptions(
|
|
65
65
|
@Field
|
|
66
|
-
val encoding: EncodingType = EncodingType.UTF8
|
|
66
|
+
val encoding: EncodingType = EncodingType.UTF8,
|
|
67
|
+
@Field
|
|
68
|
+
val append: Boolean = false
|
|
67
69
|
) : Record
|
|
68
70
|
|
|
69
71
|
data class FileSystemUploadOptions(
|
|
@@ -95,7 +95,7 @@ class AssetFile(private val context: Context, override val uri: Uri) : UnifiedFi
|
|
|
95
95
|
return null
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
override fun outputStream(): OutputStream {
|
|
98
|
+
override fun outputStream(append: Boolean): OutputStream {
|
|
99
99
|
throw UnsupportedOperationException("Asset files are not writable")
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -68,8 +68,8 @@ class JavaFile(override val uri: Uri) : UnifiedFileInterface, File(URI.create(ur
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
override fun outputStream(): OutputStream {
|
|
72
|
-
return FileOutputStream(this)
|
|
71
|
+
override fun outputStream(append: Boolean): OutputStream {
|
|
72
|
+
return FileOutputStream(this, append)
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
override fun inputStream(): InputStream {
|
|
@@ -70,14 +70,15 @@ class SAFDocumentFile(private val context: Context, override val uri: Uri) : Uni
|
|
|
70
70
|
return null
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
override fun outputStream(): OutputStream {
|
|
74
|
-
|
|
73
|
+
override fun outputStream(append: Boolean): OutputStream {
|
|
74
|
+
val mode = if (append) "wa" else "w"
|
|
75
|
+
return context.contentResolver.openOutputStream(uri, mode)
|
|
75
76
|
?: throw IllegalStateException("Unable to open output stream for URI: $uri")
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
override fun inputStream(): InputStream {
|
|
79
80
|
return context.contentResolver.openInputStream(uri)
|
|
80
|
-
?: throw IllegalStateException("Unable to open
|
|
81
|
+
?: throw IllegalStateException("Unable to open input stream for URI: $uri")
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
override fun length(): Long {
|
|
@@ -19,7 +19,7 @@ interface UnifiedFileInterface {
|
|
|
19
19
|
val creationTime: Long?
|
|
20
20
|
val fileName: String?
|
|
21
21
|
fun getContentUri(appContext: AppContext): Uri
|
|
22
|
-
fun outputStream(): java.io.OutputStream
|
|
22
|
+
fun outputStream(append: Boolean = false): java.io.OutputStream
|
|
23
23
|
fun inputStream(): java.io.InputStream
|
|
24
24
|
fun length(): Long
|
|
25
25
|
fun walkTopDown(): Sequence<UnifiedFileInterface>
|
|
@@ -26,6 +26,11 @@ export type FileWriteOptions = {
|
|
|
26
26
|
* @default FileSystem.EncodingType.UTF8
|
|
27
27
|
*/
|
|
28
28
|
encoding?: EncodingType | 'utf8' | 'base64';
|
|
29
|
+
/**
|
|
30
|
+
* Whether to append the contents to the end of the file or overwrite the existing file.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
append?: boolean;
|
|
29
34
|
};
|
|
30
35
|
export type DirectoryCreateOptions = {
|
|
31
36
|
/**
|
|
@@ -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,oBAAY,YAAY;IACtB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;
|
|
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,oBAAY,YAAY;IACtB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,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,QAA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AC;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"}
|
|
@@ -244,6 +244,11 @@ export type WritingOptions = {
|
|
|
244
244
|
* @default FileSystem.EncodingType.UTF8
|
|
245
245
|
*/
|
|
246
246
|
encoding?: EncodingType | 'utf8' | 'base64';
|
|
247
|
+
/**
|
|
248
|
+
* Whether to append the contents to the end of the file or overwrite the existing file.
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
append?: boolean;
|
|
247
252
|
};
|
|
248
253
|
export type DeletingOptions = {
|
|
249
254
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystem.types.d.ts","sourceRoot":"","sources":["../../src/legacy/FileSystem.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B;;;;OAIG;IACH,UAAU,IAAI;IACd;;;OAGG;IACH,UAAU,IAAI;CACf;AAED,oBAAY,oBAAoB;IAC9B;;OAEG;IACH,cAAc,IAAI;IAClB;;;OAGG;IACH,SAAS,IAAI;CACd;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC,CAAC;AAEF,MAAM,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;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,MAAM,MAAM,2CAA2C;AACrD;;GAEG;AACD;IACE,OAAO,EAAE,KAAK,CAAC;CAChB;AACH;;GAEG;GACD;IACE,OAAO,EAAE,IAAI,CAAC;IACd;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
package/expo-module.config.json
CHANGED
package/ios/FileSystemFile.swift
CHANGED
|
@@ -75,23 +75,49 @@ internal final class FileSystemFile: FileSystemPath {
|
|
|
75
75
|
return nil
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
func write(_ content: String) throws {
|
|
78
|
+
func write(_ content: String, append: Bool = false) throws {
|
|
79
79
|
try withCorrectTypeAndScopedAccess(permission: .write) {
|
|
80
|
-
|
|
80
|
+
if append, let data = content.data(using: .utf8) {
|
|
81
|
+
try writeAppending(data)
|
|
82
|
+
} else {
|
|
83
|
+
try content.write(to: url, atomically: false, encoding: .utf8) // TODO: better error handling
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
87
|
|
|
84
|
-
func write(_ data: Data) throws {
|
|
88
|
+
func write(_ data: Data, append: Bool = false) throws {
|
|
85
89
|
try withCorrectTypeAndScopedAccess(permission: .write) {
|
|
86
|
-
|
|
90
|
+
if append {
|
|
91
|
+
try writeAppending(data)
|
|
92
|
+
} else {
|
|
93
|
+
try data.write(to: url)
|
|
94
|
+
}
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
// TODO: blob support
|
|
91
|
-
func write(_ content: TypedArray) throws {
|
|
99
|
+
func write(_ content: TypedArray, append: Bool = false) throws {
|
|
92
100
|
try withCorrectTypeAndScopedAccess(permission: .write) {
|
|
93
|
-
|
|
101
|
+
let data = Data(bytes: content.rawPointer, count: content.byteLength)
|
|
102
|
+
if append {
|
|
103
|
+
try writeAppending(data)
|
|
104
|
+
} else {
|
|
105
|
+
try data.write(to: url)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private func writeAppending(_ data: Data) throws {
|
|
111
|
+
if !FileManager.default.fileExists(atPath: url.path) {
|
|
112
|
+
try data.write(to: url)
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
let fileHandle = try FileHandle(forWritingTo: url)
|
|
116
|
+
defer {
|
|
117
|
+
fileHandle.closeFile()
|
|
94
118
|
}
|
|
119
|
+
fileHandle.seekToEndOfFile()
|
|
120
|
+
fileHandle.write(data)
|
|
95
121
|
}
|
|
96
122
|
|
|
97
123
|
func text() throws -> String {
|
|
@@ -203,18 +203,19 @@ public final class FileSystemModule: Module {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
Function("write") { (file: FileSystemFile, content: Either<String, TypedArray>, options: WriteOptions?) in
|
|
206
|
+
let append = options?.append ?? false
|
|
206
207
|
if let content: String = content.get() {
|
|
207
208
|
if options?.encoding == WriteEncoding.base64 {
|
|
208
209
|
guard let data = Data(base64Encoded: content, options: .ignoreUnknownCharacters) else {
|
|
209
210
|
throw UnableToWriteBase64DataException(file.url.absoluteString)
|
|
210
211
|
}
|
|
211
|
-
try file.write(data)
|
|
212
|
+
try file.write(data, append: append)
|
|
212
213
|
} else {
|
|
213
|
-
try file.write(content)
|
|
214
|
+
try file.write(content, append: append)
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
if let content: TypedArray = content.get() {
|
|
217
|
-
try file.write(content)
|
|
218
|
+
try file.write(content, append: append)
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
|
|
@@ -75,12 +75,32 @@ public final class FileSystemLegacyModule: Module {
|
|
|
75
75
|
AsyncFunction("writeAsStringAsync") { (url: URL, string: String, options: WritingOptions) in
|
|
76
76
|
try ensurePathPermission(appContext, path: url.path, flag: .write)
|
|
77
77
|
|
|
78
|
+
let data: Data?
|
|
78
79
|
if options.encoding == .base64 {
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
data = Data(base64Encoded: string, options: .ignoreUnknownCharacters)
|
|
81
|
+
} else {
|
|
82
|
+
data = string.data(using: options.encoding.toStringEncoding() ?? .utf8)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
guard let data else {
|
|
86
|
+
throw FileNotWritableException(url.path)
|
|
81
87
|
}
|
|
88
|
+
|
|
82
89
|
do {
|
|
83
|
-
|
|
90
|
+
if options.append {
|
|
91
|
+
if !FileManager.default.fileExists(atPath: url.path) {
|
|
92
|
+
try data.write(to: url, options: .atomic)
|
|
93
|
+
} else {
|
|
94
|
+
let fileHandle = try FileHandle(forWritingTo: url)
|
|
95
|
+
defer {
|
|
96
|
+
fileHandle.closeFile()
|
|
97
|
+
}
|
|
98
|
+
fileHandle.seekToEndOfFile()
|
|
99
|
+
fileHandle.write(data)
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
try data.write(to: url, options: .atomic)
|
|
103
|
+
}
|
|
84
104
|
} catch {
|
|
85
105
|
throw FileNotWritableException(url.path)
|
|
86
106
|
.causedBy(error)
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2db4f9ed8b9d33a268f5d178258a0940
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
26228ac4a06f1b0d194526c8c18ce08bd72fb558
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b4b15c18d09697dde3076e44cf19b85fc0d300aa6ea6e1dd9330d594e4c22bba
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a792cc9378d23ceea6535dc9aed7c042cc94a7579abc279778edfa5e3c79a93676e3eaa5fde7e410287d54a48f8956c92e5219d529466dbf9e9fd2b18aa1f9a5
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dce1044ec84372e8d1633dd57a5ceb0f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bef1ca59733b8ded71d49188ab697d3ce6edba9e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f761bd7862443e5848fa940a0947ff4be2432ae5dc74f0188bcc9be808db36ae
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
162c6bbf9b9b3b96082486818b9895282cd5f5bcab55ca67787e621b05f8093bd653caadf8ebacf90d3db436bf825c565fc2c1381f15e2090ed1da7d1e373406
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.filesystem",
|
|
6
|
-
"version": "55.0.
|
|
6
|
+
"version": "55.0.5",
|
|
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-55.0.
|
|
79
|
-
"url": "expo.modules.filesystem-55.0.
|
|
80
|
-
"size":
|
|
81
|
-
"sha512": "
|
|
82
|
-
"sha256": "
|
|
83
|
-
"sha1": "
|
|
84
|
-
"md5": "
|
|
78
|
+
"name": "expo.modules.filesystem-55.0.5.aar",
|
|
79
|
+
"url": "expo.modules.filesystem-55.0.5.aar",
|
|
80
|
+
"size": 391017,
|
|
81
|
+
"sha512": "162c6bbf9b9b3b96082486818b9895282cd5f5bcab55ca67787e621b05f8093bd653caadf8ebacf90d3db436bf825c565fc2c1381f15e2090ed1da7d1e373406",
|
|
82
|
+
"sha256": "f761bd7862443e5848fa940a0947ff4be2432ae5dc74f0188bcc9be808db36ae",
|
|
83
|
+
"sha1": "bef1ca59733b8ded71d49188ab697d3ce6edba9e",
|
|
84
|
+
"md5": "dce1044ec84372e8d1633dd57a5ceb0f"
|
|
85
85
|
}
|
|
86
86
|
]
|
|
87
87
|
},
|
|
@@ -153,13 +153,13 @@
|
|
|
153
153
|
],
|
|
154
154
|
"files": [
|
|
155
155
|
{
|
|
156
|
-
"name": "expo.modules.filesystem-55.0.
|
|
157
|
-
"url": "expo.modules.filesystem-55.0.
|
|
158
|
-
"size":
|
|
159
|
-
"sha512": "
|
|
160
|
-
"sha256": "
|
|
161
|
-
"sha1": "
|
|
162
|
-
"md5": "
|
|
156
|
+
"name": "expo.modules.filesystem-55.0.5.aar",
|
|
157
|
+
"url": "expo.modules.filesystem-55.0.5.aar",
|
|
158
|
+
"size": 391017,
|
|
159
|
+
"sha512": "162c6bbf9b9b3b96082486818b9895282cd5f5bcab55ca67787e621b05f8093bd653caadf8ebacf90d3db436bf825c565fc2c1381f15e2090ed1da7d1e373406",
|
|
160
|
+
"sha256": "f761bd7862443e5848fa940a0947ff4be2432ae5dc74f0188bcc9be808db36ae",
|
|
161
|
+
"sha1": "bef1ca59733b8ded71d49188ab697d3ce6edba9e",
|
|
162
|
+
"md5": "dce1044ec84372e8d1633dd57a5ceb0f"
|
|
163
163
|
}
|
|
164
164
|
]
|
|
165
165
|
},
|
|
@@ -173,13 +173,13 @@
|
|
|
173
173
|
},
|
|
174
174
|
"files": [
|
|
175
175
|
{
|
|
176
|
-
"name": "expo.modules.filesystem-55.0.
|
|
177
|
-
"url": "expo.modules.filesystem-55.0.
|
|
178
|
-
"size":
|
|
179
|
-
"sha512": "
|
|
180
|
-
"sha256": "
|
|
181
|
-
"sha1": "
|
|
182
|
-
"md5": "
|
|
176
|
+
"name": "expo.modules.filesystem-55.0.5-sources.jar",
|
|
177
|
+
"url": "expo.modules.filesystem-55.0.5-sources.jar",
|
|
178
|
+
"size": 27819,
|
|
179
|
+
"sha512": "a792cc9378d23ceea6535dc9aed7c042cc94a7579abc279778edfa5e3c79a93676e3eaa5fde7e410287d54a48f8956c92e5219d529466dbf9e9fd2b18aa1f9a5",
|
|
180
|
+
"sha256": "b4b15c18d09697dde3076e44cf19b85fc0d300aa6ea6e1dd9330d594e4c22bba",
|
|
181
|
+
"sha1": "26228ac4a06f1b0d194526c8c18ce08bd72fb558",
|
|
182
|
+
"md5": "2db4f9ed8b9d33a268f5d178258a0940"
|
|
183
183
|
}
|
|
184
184
|
]
|
|
185
185
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a9a705c175f807abdf9c7e9b904cad99
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d140f739c02ff818a9819ac059de41a0bfcfa662
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f498304afc9e5ecd84a85711a059f1795800d40df5e41a94639cc54b5c549c15
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f5dd0558e4f69899b7e21a83f9355a768aa80212b856985aa452748642b4392fbeaebb50071c5f20459cbff1d45039022b8d27157a632239fee12564dff50567
|
|
@@ -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>55.0.
|
|
12
|
+
<version>55.0.5</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
|
+
6eb06f3bcd925ae8af1142e445a6247c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f87cfcabb28989887de2ffcdbbaa977a2f564341
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2ffa7f377d7256c44a65bb914bbc915afbebcb74860a374f0685518c94e43424
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
658394d15e12c861535f80a3dea34791ee01a9f3cd85e56b802d9a4658e819647d82c82d5135ecb2f5d76fa03fd186ce719f89999b8bec740d40b2faa69f126c
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.filesystem</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>55.0.
|
|
7
|
-
<release>55.0.
|
|
6
|
+
<latest>55.0.5</latest>
|
|
7
|
+
<release>55.0.5</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>55.0.
|
|
9
|
+
<version>55.0.5</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260208025459</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6ff9deff901f8c2a16bbd0636adf4bb4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
8816aa0b08b5891522c250aae3cca654cf9d1f29
|
package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1298e68ebf10f5b4589d08e968c95854b8613537f0030207c28072590c273de1
|
package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
65fbdee5e02ed3388308b4059dbee530ed444627bfc71a3afe349fb41088553bf58822c8886c230f27e83465729c94d1ef8f63cf095d75033ac945373fb22179
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-file-system",
|
|
3
|
-
"version": "55.0.
|
|
3
|
+
"version": "55.0.5",
|
|
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",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"expo": "*",
|
|
56
56
|
"react-native": "*"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "cd3638bb85f9560392acfd5160a266cf97880b3b"
|
|
59
59
|
}
|
|
@@ -28,6 +28,11 @@ export type FileWriteOptions = {
|
|
|
28
28
|
* @default FileSystem.EncodingType.UTF8
|
|
29
29
|
*/
|
|
30
30
|
encoding?: EncodingType | 'utf8' | 'base64';
|
|
31
|
+
/**
|
|
32
|
+
* Whether to append the contents to the end of the file or overwrite the existing file.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
append?: boolean;
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
export type DirectoryCreateOptions = {
|
|
@@ -269,6 +269,11 @@ export type WritingOptions = {
|
|
|
269
269
|
* @default FileSystem.EncodingType.UTF8
|
|
270
270
|
*/
|
|
271
271
|
encoding?: EncodingType | 'utf8' | 'base64';
|
|
272
|
+
/**
|
|
273
|
+
* Whether to append the contents to the end of the file or overwrite the existing file.
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
276
|
+
append?: boolean;
|
|
272
277
|
};
|
|
273
278
|
|
|
274
279
|
export type DeletingOptions = {
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bf72d26fe28bec2e7f5942f57fa45fa0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e9a3ae376ac5f6353f5a8583530d56ab3d539ea2
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
93bc2737eea73f9a6d6a85a9ae71695b04652af5876dbf21a60b9903e4c4133d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
72cb0cc7570e89b67e831ff8b6283ac3d96fff74add3e2fc53f04a76846be336a5a877e24612080aacac1786f0da74ef1b2704d86326506de629f289b9a33c58
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8a8614ae30e160cdc96805c6361bacbe
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c6b80673784e3cbd1e2cab0354c3d9340b2fb433
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2b9684d9983f06a3a381cb5d89808a501fe0ba3289128e8e19ae355f29ed6d89
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bac4c8e263a5ac9bad3d552d67bef08845b69538ea06377043b88cb85765045ecc2bf7950113a74851f8e32de0859231784cbb4c36fb377fe05a97375d240165
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6ed01e1c8df2e254ab252148d180d80b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6fd46eb6b2b937c2a9a8fd2dfecdaf17e1c9da6a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e00575c2f9215ecd92499dd6f3fb110f0c3d64fb42eebff8b6237dad86bc7411
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
05f3579f7e3b31ae8545376a3d05298ec757fb82c078f07572faa732804bf2972bc0342157c5aa58b6c97f359a6fe67c95d428278fad57945b3d204ae9d17774
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
057fb4b4a48a67fedd3b35a8ccf69471
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a992635ee4affb5f4735cce7f954ab782c397ffd
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7b10bd037b382eb8b5583d5bb9820ba7357bc12fa34f316796d9a5ba6ffbdbaf
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
43bd9036b0759300231c34f4c4d2354b10e20587a58c78bc349ef2921ee0e189b5cb1469dc1bbb1b94d08a0a92cdfd5a21f063663e2b45a2619ac0d041885cfe
|