expo-file-system 18.2.0-canary-20250701-6a945c5 → 18.2.0-canary-20250709-136b77f
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 +1 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +1 -1
- package/android/src/main/java/expo/modules/filesystem/FileSystemRecords.kt +1 -3
- package/android/src/main/java/expo/modules/filesystem/next/FileSystemFile.kt +50 -0
- package/android/src/main/java/expo/modules/filesystem/next/FileSystemNextExceptions.kt +5 -0
- package/android/src/main/java/expo/modules/filesystem/next/FileSystemNextModule.kt +25 -0
- package/android/src/main/java/expo/modules/filesystem/next/FileSystemNextRecords.kt +14 -0
- package/build/next/ExpoFileSystem.types.d.ts +58 -2
- package/build/next/ExpoFileSystem.types.d.ts.map +1 -1
- package/build/next/FileSystem.d.ts +5 -0
- package/build/next/FileSystem.d.ts.map +1 -1
- package/build/next/index.d.ts +1 -1
- package/build/next/index.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/ExpoFileSystem.podspec +1 -1
- package/ios/FileSystemRecords.swift +0 -1
- package/ios/Next/FileSystemFile.swift +59 -14
- package/ios/Next/FileSystemNextExceptions.swift +12 -0
- package/ios/Next/FileSystemNextModule.swift +32 -0
- package/ios/Next/FileSystemNextRecords.swift +14 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.module → 18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.pom → 18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250709-136b77f/expo.modules.filesystem-18.2.0-canary-20250709-136b77f.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 +4 -4
- package/src/next/ExpoFileSystem.types.ts +64 -2
- package/src/next/FileSystem.ts +9 -2
- package/src/next/index.ts +7 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250701-6a945c5/expo.modules.filesystem-18.2.0-canary-20250701-6a945c5.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
### 🎉 New features
|
|
8
8
|
|
|
9
9
|
- Add total and available sizes, directory sizes. ([#37594](https://github.com/expo/expo/pull/37594) by [@aleqsio](https://github.com/aleqsio))
|
|
10
|
+
- Add info method, modificationTime and creationTime properties to file-system/next. ([#37505](https://github.com/expo/expo/pull/37505) by [@Wenszel](https://github.com/Wenszel))
|
|
10
11
|
- Add support for custom headers in downloadFileAsync ([#36108](https://github.com/expo/expo/pull/36108) by [@leonhh](https://github.com/leonhh))
|
|
11
12
|
|
|
12
13
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -4,13 +4,13 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '18.2.0-canary-
|
|
7
|
+
version = '18.2.0-canary-20250709-136b77f'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.filesystem"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 30
|
|
13
|
-
versionName "18.2.0-canary-
|
|
13
|
+
versionName "18.2.0-canary-20250709-136b77f"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -65,7 +65,7 @@ private const val EXUploadProgressEventName = "expo-file-system.uploadProgress"
|
|
|
65
65
|
private const val MIN_EVENT_DT_MS: Long = 100
|
|
66
66
|
private const val DIR_PERMISSIONS_REQUEST_CODE = 5394
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
fun slashifyFilePath(path: String?): String? {
|
|
69
69
|
return if (path == null) {
|
|
70
70
|
null
|
|
71
71
|
} else if (path.startsWith("file:///")) {
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
package expo.modules.filesystem.next
|
|
2
2
|
|
|
3
3
|
import android.net.Uri
|
|
4
|
+
import android.os.Build
|
|
4
5
|
import android.util.Base64
|
|
5
6
|
import android.webkit.MimeTypeMap
|
|
7
|
+
import expo.modules.filesystem.InfoOptions
|
|
8
|
+
import expo.modules.filesystem.slashifyFilePath
|
|
6
9
|
import expo.modules.interfaces.filesystem.Permission
|
|
7
10
|
import expo.modules.kotlin.apifeatures.EitherType
|
|
8
11
|
import expo.modules.kotlin.typedarray.TypedArray
|
|
9
12
|
import java.io.File
|
|
10
13
|
import java.io.FileOutputStream
|
|
14
|
+
import java.nio.file.attribute.BasicFileAttributes
|
|
11
15
|
import java.security.MessageDigest
|
|
16
|
+
import kotlin.io.path.Path
|
|
17
|
+
import kotlin.io.path.readAttributes
|
|
18
|
+
import kotlin.time.Duration.Companion.milliseconds
|
|
12
19
|
|
|
13
20
|
@OptIn(EitherType::class)
|
|
14
21
|
class FileSystemFile(file: File) : FileSystemPath(file) {
|
|
@@ -114,4 +121,47 @@ class FileSystemFile(file: File) : FileSystemPath(file) {
|
|
|
114
121
|
return MimeTypeMap.getFileExtensionFromUrl(file.path)
|
|
115
122
|
?.run { MimeTypeMap.getSingleton().getMimeTypeFromExtension(lowercase()) }
|
|
116
123
|
}
|
|
124
|
+
|
|
125
|
+
val modificationTime: Long get() {
|
|
126
|
+
validateType()
|
|
127
|
+
return file.lastModified()
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
val creationTime: Long? get() {
|
|
131
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
132
|
+
validateType()
|
|
133
|
+
val attributes = Path(file.path).readAttributes<BasicFileAttributes>()
|
|
134
|
+
return attributes.creationTime().toMillis().milliseconds.inWholeMilliseconds
|
|
135
|
+
} else {
|
|
136
|
+
return null
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
fun info(options: InfoOptions?): FileInfo {
|
|
141
|
+
validateType()
|
|
142
|
+
validatePermission(Permission.READ)
|
|
143
|
+
if (!file.exists()) {
|
|
144
|
+
val fileInfo = FileInfo(
|
|
145
|
+
exists = false,
|
|
146
|
+
uri = slashifyFilePath(file.toURI().toString())
|
|
147
|
+
)
|
|
148
|
+
return fileInfo
|
|
149
|
+
}
|
|
150
|
+
when {
|
|
151
|
+
file.toURI().scheme == "file" -> {
|
|
152
|
+
val fileInfo = FileInfo(
|
|
153
|
+
exists = true,
|
|
154
|
+
uri = slashifyFilePath(file.toURI().toString()),
|
|
155
|
+
size = size,
|
|
156
|
+
modificationTime = modificationTime,
|
|
157
|
+
creationTime = creationTime
|
|
158
|
+
)
|
|
159
|
+
if (options != null && options.md5 == true) {
|
|
160
|
+
fileInfo.md5 = md5
|
|
161
|
+
}
|
|
162
|
+
return fileInfo
|
|
163
|
+
}
|
|
164
|
+
else -> throw UnableToGetInfoException("file schema ${file.toURI().scheme} is not supported")
|
|
165
|
+
}
|
|
166
|
+
}
|
|
117
167
|
}
|
|
@@ -44,6 +44,11 @@ internal class UnableToWriteHandleException(reason: String) :
|
|
|
44
44
|
"Unable to write to a file handle: '$reason'"
|
|
45
45
|
)
|
|
46
46
|
|
|
47
|
+
internal class UnableToGetInfoException(reason: String) :
|
|
48
|
+
CodedException(
|
|
49
|
+
"Unable to get info from a file: '$reason'"
|
|
50
|
+
)
|
|
51
|
+
|
|
47
52
|
internal class DestinationAlreadyExistsException :
|
|
48
53
|
CodedException(
|
|
49
54
|
"Destination already exists"
|
|
@@ -3,6 +3,7 @@ package expo.modules.filesystem.next
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.net.Uri
|
|
5
5
|
import android.webkit.URLUtil
|
|
6
|
+
import expo.modules.filesystem.InfoOptions
|
|
6
7
|
import expo.modules.interfaces.filesystem.Permission
|
|
7
8
|
import expo.modules.kotlin.apifeatures.EitherType
|
|
8
9
|
import expo.modules.kotlin.devtools.await
|
|
@@ -17,6 +18,7 @@ import okhttp3.Request
|
|
|
17
18
|
import java.io.File
|
|
18
19
|
import java.io.FileOutputStream
|
|
19
20
|
import java.net.URI
|
|
21
|
+
import java.util.EnumSet
|
|
20
22
|
|
|
21
23
|
class FileSystemNextModule : Module() {
|
|
22
24
|
private val context: Context
|
|
@@ -79,6 +81,17 @@ class FileSystemNextModule : Module() {
|
|
|
79
81
|
return@Coroutine destination.path
|
|
80
82
|
}
|
|
81
83
|
|
|
84
|
+
Function("info") { url: URI ->
|
|
85
|
+
val file = File(url)
|
|
86
|
+
val permissions = appContext.filePermission?.getPathPermissions(appContext.reactContext, file.path)
|
|
87
|
+
?: EnumSet.noneOf(Permission::class.java)
|
|
88
|
+
if (permissions.contains(Permission.READ) && file.exists()) {
|
|
89
|
+
PathInfo(exists = file.exists(), isDirectory = file.isDirectory)
|
|
90
|
+
} else {
|
|
91
|
+
PathInfo(exists = false, isDirectory = null)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
82
95
|
Class(FileSystemFile::class) {
|
|
83
96
|
Constructor { uri: URI ->
|
|
84
97
|
FileSystemFile(File(uri.path))
|
|
@@ -120,10 +133,22 @@ class FileSystemNextModule : Module() {
|
|
|
120
133
|
file.bytes()
|
|
121
134
|
}
|
|
122
135
|
|
|
136
|
+
Function("info") { file: FileSystemFile, options: InfoOptions? ->
|
|
137
|
+
file.info(options)
|
|
138
|
+
}
|
|
139
|
+
|
|
123
140
|
Property("exists") { file: FileSystemFile ->
|
|
124
141
|
file.exists
|
|
125
142
|
}
|
|
126
143
|
|
|
144
|
+
Property("modificationTime") { file: FileSystemFile ->
|
|
145
|
+
file.modificationTime
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
Property("creationTime") { file: FileSystemFile ->
|
|
149
|
+
file.creationTime
|
|
150
|
+
}
|
|
151
|
+
|
|
127
152
|
Function("copy") { file: FileSystemFile, destination: FileSystemPath ->
|
|
128
153
|
file.copy(destination)
|
|
129
154
|
}
|
|
@@ -14,3 +14,17 @@ data class DownloadOptionsNext(
|
|
|
14
14
|
@Field
|
|
15
15
|
val headers: Map<String, String> = emptyMap()
|
|
16
16
|
) : Record
|
|
17
|
+
|
|
18
|
+
data class FileInfo(
|
|
19
|
+
@Field var exists: Boolean,
|
|
20
|
+
@Field var uri: String?,
|
|
21
|
+
@Field var md5: String? = null,
|
|
22
|
+
@Field var size: Long? = null,
|
|
23
|
+
@Field var modificationTime: Long? = null,
|
|
24
|
+
@Field var creationTime: Long? = null
|
|
25
|
+
) : Record
|
|
26
|
+
|
|
27
|
+
data class PathInfo(
|
|
28
|
+
@Field var exists: Boolean,
|
|
29
|
+
@Field var isDirectory: Boolean?
|
|
30
|
+
) : Record
|
|
@@ -36,8 +36,7 @@ export declare class Directory {
|
|
|
36
36
|
*/
|
|
37
37
|
delete(): void;
|
|
38
38
|
/**
|
|
39
|
-
* A boolean representing if a directory exists
|
|
40
|
-
* Also, `false` if the application does not have read access to the file.
|
|
39
|
+
* A boolean representing if a directory exists and can be accessed.
|
|
41
40
|
*/
|
|
42
41
|
exists: boolean;
|
|
43
42
|
/**
|
|
@@ -125,6 +124,12 @@ export declare class File {
|
|
|
125
124
|
* @throws Error if the directory does not exist or cannot be deleted.
|
|
126
125
|
*/
|
|
127
126
|
delete(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Retrieves an object containing properties of a file
|
|
129
|
+
* @throws Error If the application does not have read access to the file, or if the path does not point to a file (e.g., it points to a directory).
|
|
130
|
+
* @returns An object with file metadata (e.g., size, creation date, etc.).
|
|
131
|
+
*/
|
|
132
|
+
info(options?: InfoOptions): FileInfo;
|
|
128
133
|
/**
|
|
129
134
|
* A boolean representing if a file exists. `true` if the file exists, `false` otherwise.
|
|
130
135
|
* Also, `false` if the application does not have read access to the file.
|
|
@@ -168,6 +173,14 @@ export declare class File {
|
|
|
168
173
|
* A md5 hash of the file. Null if the file does not exist, or it cannot be read.
|
|
169
174
|
*/
|
|
170
175
|
md5: string | null;
|
|
176
|
+
/**
|
|
177
|
+
* A last modification time of the file expressed in milliseconds since epoch. Returns a Null if the file does not exist, or it cannot be read.
|
|
178
|
+
*/
|
|
179
|
+
modificationTime: number | null;
|
|
180
|
+
/**
|
|
181
|
+
* A creation time of the file expressed in milliseconds since epoch. Returns null if the file does not exist, cannot be read or the Android version is earlier than API 26.
|
|
182
|
+
*/
|
|
183
|
+
creationTime: number | null;
|
|
171
184
|
/**
|
|
172
185
|
* A mime type of the file. Null if the file does not exist, or it cannot be read.
|
|
173
186
|
*/
|
|
@@ -180,4 +193,47 @@ export declare class FileHandle {
|
|
|
180
193
|
offset: number | null;
|
|
181
194
|
size: number | null;
|
|
182
195
|
}
|
|
196
|
+
export type FileInfo = {
|
|
197
|
+
/**
|
|
198
|
+
* Indicates whether the file exists.
|
|
199
|
+
*/
|
|
200
|
+
exists: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* A `file://` URI pointing to the file. This is the same as the `fileUri` input parameter.
|
|
203
|
+
*/
|
|
204
|
+
uri?: string;
|
|
205
|
+
/**
|
|
206
|
+
* The size of the file in bytes.
|
|
207
|
+
*/
|
|
208
|
+
size?: number;
|
|
209
|
+
/**
|
|
210
|
+
* The last modification time of the file expressed in milliseconds since epoch.
|
|
211
|
+
*/
|
|
212
|
+
modificationTime?: number;
|
|
213
|
+
/**
|
|
214
|
+
* A creation time of the file expressed in milliseconds since epoch. Returns null if the Android version is earlier than API 26.
|
|
215
|
+
*/
|
|
216
|
+
creationTime?: number;
|
|
217
|
+
/**
|
|
218
|
+
* Present if the `md5` option was truthy. Contains the MD5 hash of the file.
|
|
219
|
+
*/
|
|
220
|
+
md5?: string;
|
|
221
|
+
};
|
|
222
|
+
export type InfoOptions = {
|
|
223
|
+
/**
|
|
224
|
+
* Whether to return the MD5 hash of the file.
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
md5?: boolean;
|
|
228
|
+
};
|
|
229
|
+
export type PathInfo = {
|
|
230
|
+
/**
|
|
231
|
+
* Indicates whether the path exists. Returns true if it exists; false if the path does not exist or if there is no read permission.
|
|
232
|
+
*/
|
|
233
|
+
exists: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Indicates whether the path is a directory. Returns true or false if the path exists; otherwise, returns null.
|
|
236
|
+
*/
|
|
237
|
+
isDirectory: boolean | null;
|
|
238
|
+
};
|
|
183
239
|
//# sourceMappingURL=ExpoFileSystem.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoFileSystem.types.d.ts","sourceRoot":"","sources":["../../src/next/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
|
|
1
|
+
{"version":3,"file":"ExpoFileSystem.types.d.ts","sourceRoot":"","sources":["../../src/next/ExpoFileSystem.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ExpoFileSystem from './ExpoFileSystem';
|
|
2
|
+
import type { PathInfo } from './ExpoFileSystem.types';
|
|
2
3
|
import { PathUtilities } from './pathUtilities';
|
|
3
4
|
export declare class Paths extends PathUtilities {
|
|
4
5
|
/**
|
|
@@ -18,6 +19,10 @@ export declare class Paths extends PathUtilities {
|
|
|
18
19
|
* A property that represents the available space on device's internal storage, represented in bytes.
|
|
19
20
|
*/
|
|
20
21
|
static get availableDiskSpace(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Returns an object that indicates if the specified path represents a directory.
|
|
24
|
+
*/
|
|
25
|
+
static info(...uris: string[]): PathInfo;
|
|
21
26
|
}
|
|
22
27
|
/**
|
|
23
28
|
* @hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../src/next/FileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../src/next/FileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,qBAAa,KAAM,SAAQ,aAAa;IACtC;;OAEG;IACH,MAAM,KAAK,KAAK,cAEf;IAED;;OAEG;IACH,MAAM,KAAK,QAAQ,cAElB;IACD,MAAM,KAAK,qBAAqB,8BAS/B;IAED;;OAEG;IACH,MAAM,KAAK,cAAc,WAExB;IAED;;OAEG;IACH,MAAM,KAAK,kBAAkB,WAE5B;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ;CAGzC;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,IAAI;IAChC,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAc;gBAEb,IAAI,EAAE,IAAI;IAKtB,IAAa,IAAI,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAa,IAAI,IAAI,MAAM,CAE1B;IAEc,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAInC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC;IAIzB,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC;IAIpC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI;CAGzE;AAED,qBAAa,IAAK,SAAQ,cAAc,CAAC,cAAc;IACrD;;;;;;;OAOG;gBACS,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE;IAQlD,IAAI,IAAI,IAAI;IAOZ,IAAI,eAAe,cAElB;IAED;;;OAGG;IACH,IAAI,SAAS,WAEZ;IAED;;OAEG;IACH,IAAI,IAAI,WAEP;IAED,cAAc;IAId,cAAc;CAGf;AAYD;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,cAAc,CAAC,mBAAmB;IAC/D;;;;;;;OAOG;gBACS,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE;IAQlD,IAAI,eAAe,cAElB;IAED;;;;OAIG;IACM,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE;IAOrC;;OAEG;IACH,IAAI,IAAI,WAEP;CACF"}
|
package/build/next/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './FileSystem';
|
|
2
|
-
export { type CreateOptions, type FileHandle } from './ExpoFileSystem.types';
|
|
2
|
+
export { type CreateOptions, type FileHandle, type FileInfo, type InfoOptions, type PathInfo, } from './ExpoFileSystem.types';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/next/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,GACd,MAAM,wBAAwB,CAAC"}
|
package/expo-module.config.json
CHANGED
|
@@ -50,20 +50,6 @@ internal final class FileSystemFile: FileSystemPath {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
var size: Int64 {
|
|
54
|
-
get throws {
|
|
55
|
-
try validatePermission(.read)
|
|
56
|
-
let attributes: [FileAttributeKey: Any] = try FileManager.default.attributesOfItem(atPath: url.path)
|
|
57
|
-
guard let size = attributes[.size] else {
|
|
58
|
-
throw UnableToGetSizeException("attributes do not contain size")
|
|
59
|
-
}
|
|
60
|
-
guard let size = size as? NSNumber else {
|
|
61
|
-
throw UnableToGetSizeException("size is not a number")
|
|
62
|
-
}
|
|
63
|
-
return size.int64Value
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
53
|
var md5: String {
|
|
68
54
|
get throws {
|
|
69
55
|
try validatePermission(.read)
|
|
@@ -73,6 +59,39 @@ internal final class FileSystemFile: FileSystemPath {
|
|
|
73
59
|
}
|
|
74
60
|
}
|
|
75
61
|
|
|
62
|
+
var size: Int64 {
|
|
63
|
+
get throws {
|
|
64
|
+
return try getAttribute(.size, atPath: url.path)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var modificationTime: Int64 {
|
|
69
|
+
get throws {
|
|
70
|
+
let modificationDate: Date = try getAttribute(.modificationDate, atPath: url.path)
|
|
71
|
+
return Int64(modificationDate.timeIntervalSince1970 * 1000)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var creationTime: Int64 {
|
|
76
|
+
get throws {
|
|
77
|
+
let creationDate: Date = try getAttribute(.creationDate, atPath: url.path)
|
|
78
|
+
return Int64(creationDate.timeIntervalSince1970 * 1000)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private func getAttribute<T>(_ key: FileAttributeKey, atPath path: String) throws -> T {
|
|
83
|
+
try validatePermission(.read)
|
|
84
|
+
let attributes = try FileManager.default.attributesOfItem(atPath: path)
|
|
85
|
+
|
|
86
|
+
guard let attribute = attributes[key] else {
|
|
87
|
+
throw UnableToGetFileAttribute("attributes do not contain \(key)")
|
|
88
|
+
}
|
|
89
|
+
guard let attributeCasted = attribute as? T else {
|
|
90
|
+
throw UnableToGetFileAttribute("\(key) is not of expected type")
|
|
91
|
+
}
|
|
92
|
+
return attributeCasted
|
|
93
|
+
}
|
|
94
|
+
|
|
76
95
|
var type: String? {
|
|
77
96
|
let pathExtension = url.pathExtension
|
|
78
97
|
if let utType = UTType(filenameExtension: pathExtension),
|
|
@@ -111,4 +130,30 @@ internal final class FileSystemFile: FileSystemPath {
|
|
|
111
130
|
try validatePermission(.read)
|
|
112
131
|
return try Data(contentsOf: url).base64EncodedString()
|
|
113
132
|
}
|
|
133
|
+
|
|
134
|
+
func info(options: InfoOptions) throws -> FileInfo {
|
|
135
|
+
try validateType()
|
|
136
|
+
try validatePermission(.read)
|
|
137
|
+
if !exists {
|
|
138
|
+
let result = FileInfo()
|
|
139
|
+
result.exists = false
|
|
140
|
+
result.uri = url.absoluteString
|
|
141
|
+
return result
|
|
142
|
+
}
|
|
143
|
+
switch url.scheme {
|
|
144
|
+
case "file":
|
|
145
|
+
let result = FileInfo()
|
|
146
|
+
result.exists = true
|
|
147
|
+
result.uri = url.absoluteString
|
|
148
|
+
result.size = try size
|
|
149
|
+
result.modificationTime = try modificationTime
|
|
150
|
+
result.creationTime = try creationTime
|
|
151
|
+
if options.md5 {
|
|
152
|
+
result.md5 = try md5
|
|
153
|
+
}
|
|
154
|
+
return result
|
|
155
|
+
default:
|
|
156
|
+
throw UnableToGetInfoException("url scheme \(String(describing: url.scheme)) is not supported")
|
|
157
|
+
}
|
|
158
|
+
}
|
|
114
159
|
}
|
|
@@ -25,6 +25,12 @@ internal final class InvalidTypeDirectoryException: Exception {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
internal final class UnableToGetFileAttribute: GenericException<String> {
|
|
29
|
+
override var reason: String {
|
|
30
|
+
"Unable to get file attribute: \(param)"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
internal final class UnableToGetSizeException: GenericException<String> {
|
|
29
35
|
override var reason: String {
|
|
30
36
|
"Unable to get file or directory size: \(param)"
|
|
@@ -49,6 +55,12 @@ internal final class UnableToReadHandleException: GenericException<String> {
|
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
internal final class UnableToGetInfoException: GenericException<String> {
|
|
59
|
+
override var reason: String {
|
|
60
|
+
"Unable to get info from a file: \(param)"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
52
64
|
internal final class DestinationAlreadyExistsException: Exception {
|
|
53
65
|
override var reason: String {
|
|
54
66
|
"Destination already exists"
|
|
@@ -94,6 +94,26 @@ public final class FileSystemNextModule: Module {
|
|
|
94
94
|
downloadTask.resume()
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
Function("info") { (url: URL) in
|
|
98
|
+
let output = PathInfo()
|
|
99
|
+
output.exists = false
|
|
100
|
+
output.isDirectory = nil
|
|
101
|
+
|
|
102
|
+
guard let permissionsManager: EXFilePermissionModuleInterface = appContext?.legacyModule(implementing: EXFilePermissionModuleInterface.self) else {
|
|
103
|
+
return output
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if permissionsManager.getPathPermissions(url.path).contains(.read) {
|
|
107
|
+
var isDirectory: ObjCBool = false
|
|
108
|
+
if FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory) {
|
|
109
|
+
output.exists = true
|
|
110
|
+
output.isDirectory = isDirectory.boolValue
|
|
111
|
+
return output
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return output
|
|
115
|
+
}
|
|
116
|
+
|
|
97
117
|
Class(FileSystemFile.self) {
|
|
98
118
|
Constructor { (url: URL) in
|
|
99
119
|
return FileSystemFile(url: url.standardizedFileURL)
|
|
@@ -121,6 +141,10 @@ public final class FileSystemNextModule: Module {
|
|
|
121
141
|
return try FileSystemFileHandle(file: file)
|
|
122
142
|
}
|
|
123
143
|
|
|
144
|
+
Function("info") { (file: FileSystemFile, options: InfoOptions?) in
|
|
145
|
+
return try file.info(options: options ?? InfoOptions())
|
|
146
|
+
}
|
|
147
|
+
|
|
124
148
|
Function("write") { (file, content: Either<String, TypedArray>) in
|
|
125
149
|
if let content: String = content.get() {
|
|
126
150
|
try file.write(content)
|
|
@@ -138,6 +162,14 @@ public final class FileSystemNextModule: Module {
|
|
|
138
162
|
try? file.md5
|
|
139
163
|
}
|
|
140
164
|
|
|
165
|
+
Property("modificationTime") { file in
|
|
166
|
+
try? file.modificationTime
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Property("creationTime") { file in
|
|
170
|
+
try? file.creationTime
|
|
171
|
+
}
|
|
172
|
+
|
|
141
173
|
Property("type") { file in
|
|
142
174
|
file.type
|
|
143
175
|
}
|
|
@@ -10,3 +10,17 @@ struct CreateOptions: Record {
|
|
|
10
10
|
struct DownloadOptionsNext: Record {
|
|
11
11
|
@Field var headers: [String: String]?
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
struct FileInfo: Record {
|
|
15
|
+
@Field var exists: Bool
|
|
16
|
+
@Field var uri: String?
|
|
17
|
+
@Field var md5: String?
|
|
18
|
+
@Field var size: Int64?
|
|
19
|
+
@Field var modificationTime: Int64?
|
|
20
|
+
@Field var creationTime: Int64?
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
struct PathInfo: Record {
|
|
24
|
+
@Field var exists: Bool
|
|
25
|
+
@Field var isDirectory: Bool?
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5f5f798cae572b28dd58b38fbd38e0ae
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f302df70d5ce843a2f3bb8f24d315f50e9ddd704
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0fa90938cd6bab9dd42eb8317887efc803b66fc48bc50f7ee396265df2ebad90
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
98b6f2472be68a98a5d1058fa135fae02bc92f8fb957929c3f6737a41bf378d3bb5412990bab5234e627c54078c9af39b1186d1bd7381056b125a1f3562cebdb
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8a997f07f9023ed299dd81b964e9251e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c27e52b1df3c9a115a63e3b3618d6fa7dbeb2b9b
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bfbfd9ab75c81c2720f13efc284bb52331714d0c3416fb85defb04c9926db14d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f1f24f5df8aab351bfdb6db9df20b4924d2a8fb63d0c41cf9ed38436f4dd291553f202970754a11a21aab1a57ba9c72b7dcff1ee7933415d5dd65c4ebb71c2f8
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.filesystem",
|
|
6
|
-
"version": "18.2.0-canary-
|
|
6
|
+
"version": "18.2.0-canary-20250709-136b77f",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
],
|
|
69
69
|
"files": [
|
|
70
70
|
{
|
|
71
|
-
"name": "expo.modules.filesystem-18.2.0-canary-
|
|
72
|
-
"url": "expo.modules.filesystem-18.2.0-canary-
|
|
73
|
-
"size":
|
|
74
|
-
"sha512": "
|
|
75
|
-
"sha256": "
|
|
76
|
-
"sha1": "
|
|
77
|
-
"md5": "
|
|
71
|
+
"name": "expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar",
|
|
72
|
+
"url": "expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar",
|
|
73
|
+
"size": 310095,
|
|
74
|
+
"sha512": "f1f24f5df8aab351bfdb6db9df20b4924d2a8fb63d0c41cf9ed38436f4dd291553f202970754a11a21aab1a57ba9c72b7dcff1ee7933415d5dd65c4ebb71c2f8",
|
|
75
|
+
"sha256": "bfbfd9ab75c81c2720f13efc284bb52331714d0c3416fb85defb04c9926db14d",
|
|
76
|
+
"sha1": "c27e52b1df3c9a115a63e3b3618d6fa7dbeb2b9b",
|
|
77
|
+
"md5": "8a997f07f9023ed299dd81b964e9251e"
|
|
78
78
|
}
|
|
79
79
|
]
|
|
80
80
|
},
|
|
@@ -139,13 +139,13 @@
|
|
|
139
139
|
],
|
|
140
140
|
"files": [
|
|
141
141
|
{
|
|
142
|
-
"name": "expo.modules.filesystem-18.2.0-canary-
|
|
143
|
-
"url": "expo.modules.filesystem-18.2.0-canary-
|
|
144
|
-
"size":
|
|
145
|
-
"sha512": "
|
|
146
|
-
"sha256": "
|
|
147
|
-
"sha1": "
|
|
148
|
-
"md5": "
|
|
142
|
+
"name": "expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar",
|
|
143
|
+
"url": "expo.modules.filesystem-18.2.0-canary-20250709-136b77f.aar",
|
|
144
|
+
"size": 310095,
|
|
145
|
+
"sha512": "f1f24f5df8aab351bfdb6db9df20b4924d2a8fb63d0c41cf9ed38436f4dd291553f202970754a11a21aab1a57ba9c72b7dcff1ee7933415d5dd65c4ebb71c2f8",
|
|
146
|
+
"sha256": "bfbfd9ab75c81c2720f13efc284bb52331714d0c3416fb85defb04c9926db14d",
|
|
147
|
+
"sha1": "c27e52b1df3c9a115a63e3b3618d6fa7dbeb2b9b",
|
|
148
|
+
"md5": "8a997f07f9023ed299dd81b964e9251e"
|
|
149
149
|
}
|
|
150
150
|
]
|
|
151
151
|
},
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
},
|
|
160
160
|
"files": [
|
|
161
161
|
{
|
|
162
|
-
"name": "expo.modules.filesystem-18.2.0-canary-
|
|
163
|
-
"url": "expo.modules.filesystem-18.2.0-canary-
|
|
164
|
-
"size":
|
|
165
|
-
"sha512": "
|
|
166
|
-
"sha256": "
|
|
167
|
-
"sha1": "
|
|
168
|
-
"md5": "
|
|
162
|
+
"name": "expo.modules.filesystem-18.2.0-canary-20250709-136b77f-sources.jar",
|
|
163
|
+
"url": "expo.modules.filesystem-18.2.0-canary-20250709-136b77f-sources.jar",
|
|
164
|
+
"size": 22326,
|
|
165
|
+
"sha512": "98b6f2472be68a98a5d1058fa135fae02bc92f8fb957929c3f6737a41bf378d3bb5412990bab5234e627c54078c9af39b1186d1bd7381056b125a1f3562cebdb",
|
|
166
|
+
"sha256": "0fa90938cd6bab9dd42eb8317887efc803b66fc48bc50f7ee396265df2ebad90",
|
|
167
|
+
"sha1": "f302df70d5ce843a2f3bb8f24d315f50e9ddd704",
|
|
168
|
+
"md5": "5f5f798cae572b28dd58b38fbd38e0ae"
|
|
169
169
|
}
|
|
170
170
|
]
|
|
171
171
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
41f7199e4a03f3a0e065b7b759150bf6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b59a3d59f6b7270b60de24ce9cd69acdc42cd657
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a1b23a741f7bf27c57d3856a013723e785c397b1f42097fe79d77a5008316146
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8c0de70d1b858125864b97af83cdde2d415260ad53fc5f0e15dc13c7f636e3fba7151807aa37295cc5ae54026a5f4127eb203c5d377224ed60edaa18364b7fa9
|
|
@@ -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>18.2.0-canary-
|
|
12
|
+
<version>18.2.0-canary-20250709-136b77f</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
|
+
add57a0788ba7a93b932c4a199a71f12
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bb1b58bcbacb2bdcee42e2b077da3d3e0d21b563
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2727833372ebe3bf6742eab801cac5ef77993b293ced29773cf7f0657936ebb4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8af3c63cbbe5428300a5b5107b300ffbb5ab86e1d64815d0d914c0aab202b6377deaf94543001ae7fddb68a57c43072b3533d8b44990238d014be3135fb4cbc6
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.filesystem</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>18.2.0-canary-
|
|
7
|
-
<release>18.2.0-canary-
|
|
6
|
+
<latest>18.2.0-canary-20250709-136b77f</latest>
|
|
7
|
+
<release>18.2.0-canary-20250709-136b77f</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>18.2.0-canary-
|
|
9
|
+
<version>18.2.0-canary-20250709-136b77f</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250709123258</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6445c4c02bdf253ba0b4429ccfd426a6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b1871c8a0dc4fc91e38e8e3796df00237f5d75fc
|
package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
e1c837646ad4911a6ef235c938a62e242ea514e13f7b3b8ff577cda970f4b083
|
package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4cfc126a4f14f58802f6d1f4f64f25a6b70584380ae8d8480fced19985d0e2b031a15701b7d86c4f7a0a298e8909c6fafe77493dbd3e3ec793ea8ecdab7a35f3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-file-system",
|
|
3
|
-
"version": "18.2.0-canary-
|
|
3
|
+
"version": "18.2.0-canary-20250709-136b77f",
|
|
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": "4.1.
|
|
39
|
-
"jest-expo": "54.0.0-canary-
|
|
38
|
+
"expo-module-scripts": "4.1.10-canary-20250709-136b77f",
|
|
39
|
+
"jest-expo": "54.0.0-canary-20250709-136b77f"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"expo": "54.0.0-canary-
|
|
42
|
+
"expo": "54.0.0-canary-20250709-136b77f",
|
|
43
43
|
"react-native": "*"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -41,8 +41,7 @@ export declare class Directory {
|
|
|
41
41
|
delete(): void;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* A boolean representing if a directory exists
|
|
45
|
-
* Also, `false` if the application does not have read access to the file.
|
|
44
|
+
* A boolean representing if a directory exists and can be accessed.
|
|
46
45
|
*/
|
|
47
46
|
exists: boolean;
|
|
48
47
|
|
|
@@ -143,6 +142,13 @@ export declare class File {
|
|
|
143
142
|
*/
|
|
144
143
|
delete(): void;
|
|
145
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Retrieves an object containing properties of a file
|
|
147
|
+
* @throws Error If the application does not have read access to the file, or if the path does not point to a file (e.g., it points to a directory).
|
|
148
|
+
* @returns An object with file metadata (e.g., size, creation date, etc.).
|
|
149
|
+
*/
|
|
150
|
+
info(options?: InfoOptions): FileInfo;
|
|
151
|
+
|
|
146
152
|
/**
|
|
147
153
|
* A boolean representing if a file exists. `true` if the file exists, `false` otherwise.
|
|
148
154
|
* Also, `false` if the application does not have read access to the file.
|
|
@@ -198,6 +204,16 @@ export declare class File {
|
|
|
198
204
|
*/
|
|
199
205
|
md5: string | null;
|
|
200
206
|
|
|
207
|
+
/**
|
|
208
|
+
* A last modification time of the file expressed in milliseconds since epoch. Returns a Null if the file does not exist, or it cannot be read.
|
|
209
|
+
*/
|
|
210
|
+
modificationTime: number | null;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* A creation time of the file expressed in milliseconds since epoch. Returns null if the file does not exist, cannot be read or the Android version is earlier than API 26.
|
|
214
|
+
*/
|
|
215
|
+
creationTime: number | null;
|
|
216
|
+
|
|
201
217
|
/**
|
|
202
218
|
* A mime type of the file. Null if the file does not exist, or it cannot be read.
|
|
203
219
|
*/
|
|
@@ -230,3 +246,49 @@ export declare class FileHandle {
|
|
|
230
246
|
*/
|
|
231
247
|
size: number | null;
|
|
232
248
|
}
|
|
249
|
+
|
|
250
|
+
export type FileInfo = {
|
|
251
|
+
/**
|
|
252
|
+
* Indicates whether the file exists.
|
|
253
|
+
*/
|
|
254
|
+
exists: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* A `file://` URI pointing to the file. This is the same as the `fileUri` input parameter.
|
|
257
|
+
*/
|
|
258
|
+
uri?: string;
|
|
259
|
+
/**
|
|
260
|
+
* The size of the file in bytes.
|
|
261
|
+
*/
|
|
262
|
+
size?: number;
|
|
263
|
+
/**
|
|
264
|
+
* The last modification time of the file expressed in milliseconds since epoch.
|
|
265
|
+
*/
|
|
266
|
+
modificationTime?: number;
|
|
267
|
+
/**
|
|
268
|
+
* A creation time of the file expressed in milliseconds since epoch. Returns null if the Android version is earlier than API 26.
|
|
269
|
+
*/
|
|
270
|
+
creationTime?: number;
|
|
271
|
+
/**
|
|
272
|
+
* Present if the `md5` option was truthy. Contains the MD5 hash of the file.
|
|
273
|
+
*/
|
|
274
|
+
md5?: string;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export type InfoOptions = {
|
|
278
|
+
/**
|
|
279
|
+
* Whether to return the MD5 hash of the file.
|
|
280
|
+
* @default false
|
|
281
|
+
*/
|
|
282
|
+
md5?: boolean;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export type PathInfo = {
|
|
286
|
+
/**
|
|
287
|
+
* Indicates whether the path exists. Returns true if it exists; false if the path does not exist or if there is no read permission.
|
|
288
|
+
*/
|
|
289
|
+
exists: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Indicates whether the path is a directory. Returns true or false if the path exists; otherwise, returns null.
|
|
292
|
+
*/
|
|
293
|
+
isDirectory: boolean | null;
|
|
294
|
+
};
|
package/src/next/FileSystem.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ExpoFileSystem from './ExpoFileSystem';
|
|
2
|
-
import type { DownloadOptions } from './ExpoFileSystem.types';
|
|
2
|
+
import type { DownloadOptions, PathInfo } from './ExpoFileSystem.types';
|
|
3
3
|
import { PathUtilities } from './pathUtilities';
|
|
4
4
|
import { FileSystemReadableStreamSource, FileSystemWritableSink } from './streams';
|
|
5
5
|
|
|
@@ -41,6 +41,13 @@ export class Paths extends PathUtilities {
|
|
|
41
41
|
static get availableDiskSpace() {
|
|
42
42
|
return ExpoFileSystem.availableDiskSpace;
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns an object that indicates if the specified path represents a directory.
|
|
47
|
+
*/
|
|
48
|
+
static info(...uris: string[]): PathInfo {
|
|
49
|
+
return ExpoFileSystem.info(uris.join('/'));
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
/**
|
|
@@ -82,7 +89,7 @@ export class FileBlob extends Blob {
|
|
|
82
89
|
return this.file.text();
|
|
83
90
|
}
|
|
84
91
|
|
|
85
|
-
|
|
92
|
+
async bytes(): Promise<Uint8Array> {
|
|
86
93
|
return this.file.bytes();
|
|
87
94
|
}
|
|
88
95
|
|
package/src/next/index.ts
CHANGED
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7bb0fa96a3a48c7967089baad9bbc721
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f21ea788e9b53e599f5573ce50b99aca98d73d86
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
64eba3915b21e22080556533181df59940a58f1e5bc6a906a4b6f3d27c1bed6b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a1f15ad9dc98fca6f88a14505a127d5e8d50b770238d771baf88a00e7601c33a9b665fc0bbe65cea7acd66999eef4da2ab81b0a6086cc155b5cb56183e162eb7
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d449724873c18702961102355232a8e8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c469ef87f1e0f39e1256948bb550fc329baa7cc7
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fcba6c733aeda2a6a147d889876f67a85d00f478e9253d7bec1d93ebab3e308c
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f3c0e1282d55bbaf8241d63e2a99e9e59f8174133b59ad8c00b8d2d251e3eae40a4933c6890efb1fa682c4ecc3ccfbc2808d6a22328e4f1a1221fb2a966fa2fb
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
929106e9467af4c5103e7f268856e9bb
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a358ab8a8508a74b483820894bfac1689114b207
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
59b67bdbee71f95069b7b1460ec9fe1c3b5c9137ac9a9091ac2d8f2286268f02
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
68588bf1381e951806ba87c828955fc0e2da0c96488b38e2b4b615e19b386ccc97a0c364ec45dfee355854d8411581da7c0bfa294a9f1ae46ebcb8dd270c64c6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
52c2c429a151f7d417b67164af3a6066
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8c09bf3486812af50a06a49d29903a2af9c715d2
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3d18f382462c3bb7257264661c28b84d263d57b5c495f81184857792d59ccba5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6471d86f3fc23417a68a7ddb83617088b328adbec90c20b030570ddbfcf330ae49e6c57cff78230b80c62d27a3fc5fc98400aebb175547d9263dd2536c051c14
|