expo-file-system 18.1.10 → 18.2.0-canary-20250611-f0afe80
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/next/FileSystemNextModule.kt +8 -2
- package/android/src/main/java/expo/modules/filesystem/next/FileSystemNextRecords.kt +5 -0
- package/build/FileSystem.d.ts +1 -1
- package/build/next/ExpoFileSystem.d.ts +2 -2
- package/build/next/ExpoFileSystem.d.ts.map +1 -1
- package/build/next/ExpoFileSystem.types.d.ts +9 -1
- package/build/next/ExpoFileSystem.types.d.ts.map +1 -1
- package/build/next/FileSystem.d.ts.map +1 -1
- package/expo-module.config.json +7 -1
- package/ios/Next/FileSystemNextModule.swift +10 -2
- package/ios/Next/FileSystemNextRecords.swift +4 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.module +173 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.pom +71 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/18.2.0-canary-20250611-f0afe80/expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml +13 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512 +1 -0
- package/package.json +5 -6
- package/src/FileSystem.ts +1 -1
- package/src/next/ExpoFileSystem.ts +6 -2
- package/src/next/ExpoFileSystem.types.ts +14 -1
- package/src/next/FileSystem.ts +10 -3
- package/src/next/pathUtilities/path.ts +3 -3
- package/src/next/streams.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
### 🎉 New features
|
|
8
8
|
|
|
9
|
+
- Add support for custom headers in downloadFileAsync ([#36108](https://github.com/expo/expo/pull/36108) by [@leonhh](https://github.com/leonhh))
|
|
10
|
+
|
|
9
11
|
### 🐛 Bug fixes
|
|
10
12
|
|
|
13
|
+
- Improved type safety in the FileSystem module to support tsconfig setups with stricter rules than the default. ([#37107](https://github.com/expo/expo/pull/37107) by [@hirbod](https://github.com/hirbod))
|
|
14
|
+
|
|
11
15
|
### 💡 Others
|
|
12
16
|
|
|
17
|
+
- Remove "Please" from warnings and errors ([#36862](https://github.com/expo/expo/pull/36862) by [@brentvatne](https://github.com/brentvatne))
|
|
18
|
+
|
|
13
19
|
## 18.1.10 — 2025-05-08
|
|
14
20
|
|
|
15
21
|
### 🐛 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.
|
|
7
|
+
version = '18.2.0-canary-20250611-f0afe80'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.filesystem"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 30
|
|
13
|
-
versionName "18.
|
|
13
|
+
versionName "18.2.0-canary-20250611-f0afe80"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -32,9 +32,15 @@ class FileSystemNextModule : Module() {
|
|
|
32
32
|
"bundleDirectory" to "asset:///"
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
AsyncFunction("downloadFileAsync") Coroutine { url: URI, to: FileSystemPath ->
|
|
35
|
+
AsyncFunction("downloadFileAsync") Coroutine { url: URI, to: FileSystemPath, options: DownloadOptionsNext? ->
|
|
36
36
|
to.validatePermission(Permission.WRITE)
|
|
37
|
-
val
|
|
37
|
+
val requestBuilder = Request.Builder().url(url.toURL())
|
|
38
|
+
|
|
39
|
+
options?.headers?.forEach { (key, value) ->
|
|
40
|
+
requestBuilder.addHeader(key, value)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
val request = requestBuilder.build()
|
|
38
44
|
val client = OkHttpClient()
|
|
39
45
|
val response = request.await(client)
|
|
40
46
|
|
package/build/FileSystem.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ export declare function downloadAsync(uri: string, fileUri: string, options?: Do
|
|
|
143
143
|
*
|
|
144
144
|
* **Server**
|
|
145
145
|
*
|
|
146
|
-
*
|
|
146
|
+
* Refer to the "[Server: Handling multipart requests](#server-handling-multipart-requests)" example - there is code for a simple Node.js server.
|
|
147
147
|
* @return Returns a Promise that resolves to `FileSystemUploadResult` object.
|
|
148
148
|
*/
|
|
149
149
|
export declare function uploadAsync(url: string, fileUri: string, options?: FileSystemUploadOptions): Promise<FileSystemUploadResult>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NativeModule } from 'expo-modules-core';
|
|
2
|
-
import type { Directory, File } from './ExpoFileSystem.types';
|
|
2
|
+
import type { Directory, File, DownloadOptions } from './ExpoFileSystem.types';
|
|
3
3
|
declare class ExpoFileSystemNextModule extends NativeModule {
|
|
4
4
|
FileSystemDirectory: typeof Directory;
|
|
5
5
|
FileSystemFile: typeof File;
|
|
6
|
-
downloadFileAsync(url: string, destination: File | Directory): Promise<string>;
|
|
6
|
+
downloadFileAsync(url: string, destination: File | Directory, options?: DownloadOptions): Promise<string>;
|
|
7
7
|
}
|
|
8
8
|
declare const _default: ExpoFileSystemNextModule;
|
|
9
9
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoFileSystem.d.ts","sourceRoot":"","sources":["../../src/next/ExpoFileSystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoFileSystem.d.ts","sourceRoot":"","sources":["../../src/next/ExpoFileSystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG/E,OAAO,OAAO,wBAAyB,SAAQ,YAAY;IACzD,mBAAmB,EAAE,OAAO,SAAS,CAAC;IACtC,cAAc,EAAE,OAAO,IAAI,CAAC;IAC5B,iBAAiB,CACf,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,IAAI,GAAG,SAAS,EAC7B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC;CACnB;;AAED,wBAEoE"}
|
|
@@ -68,6 +68,14 @@ export declare class Directory {
|
|
|
68
68
|
*/
|
|
69
69
|
list(): (Directory | File)[];
|
|
70
70
|
}
|
|
71
|
+
export type DownloadOptions = {
|
|
72
|
+
/**
|
|
73
|
+
* The headers to send with the request.
|
|
74
|
+
*/
|
|
75
|
+
headers?: {
|
|
76
|
+
[key: string]: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
71
79
|
/**
|
|
72
80
|
* Represents a file on the file system.
|
|
73
81
|
*/
|
|
@@ -147,7 +155,7 @@ export declare class File {
|
|
|
147
155
|
* const file = await File.downloadFileAsync("https://example.com/image.png", new Directory(Paths.document));
|
|
148
156
|
* ```
|
|
149
157
|
*/
|
|
150
|
-
static downloadFileAsync(url: string, destination: Directory | File): Promise<File>;
|
|
158
|
+
static downloadFileAsync(url: string, destination: Directory | File, options?: DownloadOptions): Promise<File>;
|
|
151
159
|
/**
|
|
152
160
|
* A size of the file in bytes. Null if the file does not exist, or it cannot be read.
|
|
153
161
|
*/
|
|
@@ -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;;;OA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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;AAE9C,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;CACF;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,IAAI;IAChC,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAc;gBAEb,IAAI,EAAE,IAAI;IAKtB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAEK,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAInC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvB,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC;IAIlC,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;CAGhE;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;IACH,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE;IAO5B;;OAEG;IACH,IAAI,IAAI,WAEP;CACF"}
|
package/expo-module.config.json
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
"modules": [
|
|
9
9
|
"expo.modules.filesystem.FileSystemModule",
|
|
10
10
|
"expo.modules.filesystem.next.FileSystemNextModule"
|
|
11
|
-
]
|
|
11
|
+
],
|
|
12
|
+
"publication": {
|
|
13
|
+
"groupId": "host.exp.exponent",
|
|
14
|
+
"artifactId": "expo.modules.filesystem",
|
|
15
|
+
"version": "18.2.0-canary-20250611-f0afe80",
|
|
16
|
+
"repository": "local-maven-repo"
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
}
|
|
@@ -16,10 +16,18 @@ public final class FileSystemNextModule: Module {
|
|
|
16
16
|
]
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
AsyncFunction("downloadFileAsync") { (url: URL, to: FileSystemPath, promise: Promise) in
|
|
19
|
+
AsyncFunction("downloadFileAsync") { (url: URL, to: FileSystemPath, options: DownloadOptionsNext?, promise: Promise) in
|
|
20
20
|
try to.validatePermission(.write)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
var request = URLRequest(url: url)
|
|
23
|
+
|
|
24
|
+
if let headers = options?.headers {
|
|
25
|
+
headers.forEach { key, value in
|
|
26
|
+
request.addValue(value, forHTTPHeaderField: key)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let downloadTask = URLSession.shared.downloadTask(with: request) { urlOrNil, responseOrNil, errorOrNil in
|
|
23
31
|
guard errorOrNil == nil else {
|
|
24
32
|
return promise.reject(UnableToDownloadException(errorOrNil?.localizedDescription ?? "unspecified error"))
|
|
25
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2003fc20bc6b10daed08f2422c631d05
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
411d53074267783a2c3abd5f70acc8ecfe206850
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0756e1e7fc3ed6c758e60d571776d16a91d67682c788082fc50f6bee8a24900c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
be40f9a68f6d8766f337229b387c4b9e019446c6b5034b222dbaeca22abe0aabc533f964aed61dc9bb32c251cfbf01def0ea36debbec0ee6ceb45e0fb271f414
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
714afc053c77e63be31a31618d09495c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
da887e7fa639fe2b40319061b5ff4d13f0f2bd62
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f7b382e83d36d7223b0b107881bf1b629072140bf85d20416a5240edcf3b8ead
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
494bbd18c43c3ec7930e9a2b8b60519ddac51f0db0e76e8e9e8a79368feaf05fac925801adb040de753f19ac5c349fa68a4cab6b1304aedfe6e8da6467c4ea39
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"formatVersion": "1.1",
|
|
3
|
+
"component": {
|
|
4
|
+
"group": "host.exp.exponent",
|
|
5
|
+
"module": "expo.modules.filesystem",
|
|
6
|
+
"version": "18.2.0-canary-20250611-f0afe80",
|
|
7
|
+
"attributes": {
|
|
8
|
+
"org.gradle.status": "release"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"createdBy": {
|
|
12
|
+
"gradle": {
|
|
13
|
+
"version": "8.14"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"variants": [
|
|
17
|
+
{
|
|
18
|
+
"name": "releaseVariantReleaseApiPublication",
|
|
19
|
+
"attributes": {
|
|
20
|
+
"org.gradle.category": "library",
|
|
21
|
+
"org.gradle.dependency.bundling": "external",
|
|
22
|
+
"org.gradle.libraryelements": "aar",
|
|
23
|
+
"org.gradle.usage": "java-api"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": [
|
|
26
|
+
{
|
|
27
|
+
"group": "commons-codec",
|
|
28
|
+
"module": "commons-codec",
|
|
29
|
+
"version": {
|
|
30
|
+
"requires": "1.10"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"group": "commons-io",
|
|
35
|
+
"module": "commons-io",
|
|
36
|
+
"version": {
|
|
37
|
+
"requires": "1.4"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"group": "com.squareup.okhttp3",
|
|
42
|
+
"module": "okhttp",
|
|
43
|
+
"version": {
|
|
44
|
+
"requires": "4.9.2"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"group": "com.squareup.okhttp3",
|
|
49
|
+
"module": "okhttp-urlconnection",
|
|
50
|
+
"version": {
|
|
51
|
+
"requires": "4.9.2"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"group": "com.squareup.okio",
|
|
56
|
+
"module": "okio",
|
|
57
|
+
"version": {
|
|
58
|
+
"requires": "2.9.0"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"group": "androidx.legacy",
|
|
63
|
+
"module": "legacy-support-v4",
|
|
64
|
+
"version": {
|
|
65
|
+
"requires": "1.0.0"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"files": [
|
|
70
|
+
{
|
|
71
|
+
"name": "expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar",
|
|
72
|
+
"url": "expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar",
|
|
73
|
+
"size": 292094,
|
|
74
|
+
"sha512": "494bbd18c43c3ec7930e9a2b8b60519ddac51f0db0e76e8e9e8a79368feaf05fac925801adb040de753f19ac5c349fa68a4cab6b1304aedfe6e8da6467c4ea39",
|
|
75
|
+
"sha256": "f7b382e83d36d7223b0b107881bf1b629072140bf85d20416a5240edcf3b8ead",
|
|
76
|
+
"sha1": "da887e7fa639fe2b40319061b5ff4d13f0f2bd62",
|
|
77
|
+
"md5": "714afc053c77e63be31a31618d09495c"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "releaseVariantReleaseRuntimePublication",
|
|
83
|
+
"attributes": {
|
|
84
|
+
"org.gradle.category": "library",
|
|
85
|
+
"org.gradle.dependency.bundling": "external",
|
|
86
|
+
"org.gradle.libraryelements": "aar",
|
|
87
|
+
"org.gradle.usage": "java-runtime"
|
|
88
|
+
},
|
|
89
|
+
"dependencies": [
|
|
90
|
+
{
|
|
91
|
+
"group": "org.jetbrains.kotlin",
|
|
92
|
+
"module": "kotlin-stdlib-jdk7",
|
|
93
|
+
"version": {
|
|
94
|
+
"requires": "2.1.20"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"group": "commons-codec",
|
|
99
|
+
"module": "commons-codec",
|
|
100
|
+
"version": {
|
|
101
|
+
"requires": "1.10"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"group": "commons-io",
|
|
106
|
+
"module": "commons-io",
|
|
107
|
+
"version": {
|
|
108
|
+
"requires": "1.4"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"group": "com.squareup.okhttp3",
|
|
113
|
+
"module": "okhttp",
|
|
114
|
+
"version": {
|
|
115
|
+
"requires": "4.9.2"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"group": "com.squareup.okhttp3",
|
|
120
|
+
"module": "okhttp-urlconnection",
|
|
121
|
+
"version": {
|
|
122
|
+
"requires": "4.9.2"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"group": "com.squareup.okio",
|
|
127
|
+
"module": "okio",
|
|
128
|
+
"version": {
|
|
129
|
+
"requires": "2.9.0"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"group": "androidx.legacy",
|
|
134
|
+
"module": "legacy-support-v4",
|
|
135
|
+
"version": {
|
|
136
|
+
"requires": "1.0.0"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"files": [
|
|
141
|
+
{
|
|
142
|
+
"name": "expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar",
|
|
143
|
+
"url": "expo.modules.filesystem-18.2.0-canary-20250611-f0afe80.aar",
|
|
144
|
+
"size": 292094,
|
|
145
|
+
"sha512": "494bbd18c43c3ec7930e9a2b8b60519ddac51f0db0e76e8e9e8a79368feaf05fac925801adb040de753f19ac5c349fa68a4cab6b1304aedfe6e8da6467c4ea39",
|
|
146
|
+
"sha256": "f7b382e83d36d7223b0b107881bf1b629072140bf85d20416a5240edcf3b8ead",
|
|
147
|
+
"sha1": "da887e7fa639fe2b40319061b5ff4d13f0f2bd62",
|
|
148
|
+
"md5": "714afc053c77e63be31a31618d09495c"
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "releaseVariantReleaseSourcePublication",
|
|
154
|
+
"attributes": {
|
|
155
|
+
"org.gradle.category": "documentation",
|
|
156
|
+
"org.gradle.dependency.bundling": "external",
|
|
157
|
+
"org.gradle.docstype": "sources",
|
|
158
|
+
"org.gradle.usage": "java-runtime"
|
|
159
|
+
},
|
|
160
|
+
"files": [
|
|
161
|
+
{
|
|
162
|
+
"name": "expo.modules.filesystem-18.2.0-canary-20250611-f0afe80-sources.jar",
|
|
163
|
+
"url": "expo.modules.filesystem-18.2.0-canary-20250611-f0afe80-sources.jar",
|
|
164
|
+
"size": 21472,
|
|
165
|
+
"sha512": "be40f9a68f6d8766f337229b387c4b9e019446c6b5034b222dbaeca22abe0aabc533f964aed61dc9bb32c251cfbf01def0ea36debbec0ee6ceb45e0fb271f414",
|
|
166
|
+
"sha256": "0756e1e7fc3ed6c758e60d571776d16a91d67682c788082fc50f6bee8a24900c",
|
|
167
|
+
"sha1": "411d53074267783a2c3abd5f70acc8ecfe206850",
|
|
168
|
+
"md5": "2003fc20bc6b10daed08f2422c631d05"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
86ee64ab445efdc2fdfe3929ba32efed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4ea06e1c09cbe4991eec37a70264f4bd866ed64d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4ab6b4b0d6b9c2cf7c04abfba21645ff1402d62b9f9e532859d06526e8edf1b7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ddf7ac73db8a903cafffe83c7b6ff74635a83f8b0ae1b09d29581a1815b45d499ab4315b187e9e31b6d91494b612baeb3218520c57a5b6fc8067d8dc08096a19
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
4
|
+
<!-- This module was also published with a richer model, Gradle metadata, -->
|
|
5
|
+
<!-- which should be used instead. Do not delete the following line which -->
|
|
6
|
+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
|
|
7
|
+
<!-- that they should prefer consuming it instead. -->
|
|
8
|
+
<!-- do_not_remove: published-with-gradle-metadata -->
|
|
9
|
+
<modelVersion>4.0.0</modelVersion>
|
|
10
|
+
<groupId>host.exp.exponent</groupId>
|
|
11
|
+
<artifactId>expo.modules.filesystem</artifactId>
|
|
12
|
+
<version>18.2.0-canary-20250611-f0afe80</version>
|
|
13
|
+
<packaging>aar</packaging>
|
|
14
|
+
<name>expo.modules.filesystem</name>
|
|
15
|
+
<url>https://github.com/expo/expo</url>
|
|
16
|
+
<licenses>
|
|
17
|
+
<license>
|
|
18
|
+
<name>MIT License</name>
|
|
19
|
+
<url>https://github.com/expo/expo/blob/main/LICENSE</url>
|
|
20
|
+
</license>
|
|
21
|
+
</licenses>
|
|
22
|
+
<scm>
|
|
23
|
+
<connection>https://github.com/expo/expo.git</connection>
|
|
24
|
+
<developerConnection>https://github.com/expo/expo.git</developerConnection>
|
|
25
|
+
<url>https://github.com/expo/expo</url>
|
|
26
|
+
</scm>
|
|
27
|
+
<dependencies>
|
|
28
|
+
<dependency>
|
|
29
|
+
<groupId>commons-codec</groupId>
|
|
30
|
+
<artifactId>commons-codec</artifactId>
|
|
31
|
+
<version>1.10</version>
|
|
32
|
+
<scope>compile</scope>
|
|
33
|
+
</dependency>
|
|
34
|
+
<dependency>
|
|
35
|
+
<groupId>commons-io</groupId>
|
|
36
|
+
<artifactId>commons-io</artifactId>
|
|
37
|
+
<version>1.4</version>
|
|
38
|
+
<scope>compile</scope>
|
|
39
|
+
</dependency>
|
|
40
|
+
<dependency>
|
|
41
|
+
<groupId>com.squareup.okhttp3</groupId>
|
|
42
|
+
<artifactId>okhttp</artifactId>
|
|
43
|
+
<version>4.9.2</version>
|
|
44
|
+
<scope>compile</scope>
|
|
45
|
+
</dependency>
|
|
46
|
+
<dependency>
|
|
47
|
+
<groupId>com.squareup.okhttp3</groupId>
|
|
48
|
+
<artifactId>okhttp-urlconnection</artifactId>
|
|
49
|
+
<version>4.9.2</version>
|
|
50
|
+
<scope>compile</scope>
|
|
51
|
+
</dependency>
|
|
52
|
+
<dependency>
|
|
53
|
+
<groupId>com.squareup.okio</groupId>
|
|
54
|
+
<artifactId>okio</artifactId>
|
|
55
|
+
<version>2.9.0</version>
|
|
56
|
+
<scope>compile</scope>
|
|
57
|
+
</dependency>
|
|
58
|
+
<dependency>
|
|
59
|
+
<groupId>androidx.legacy</groupId>
|
|
60
|
+
<artifactId>legacy-support-v4</artifactId>
|
|
61
|
+
<version>1.0.0</version>
|
|
62
|
+
<scope>compile</scope>
|
|
63
|
+
</dependency>
|
|
64
|
+
<dependency>
|
|
65
|
+
<groupId>org.jetbrains.kotlin</groupId>
|
|
66
|
+
<artifactId>kotlin-stdlib-jdk7</artifactId>
|
|
67
|
+
<version>2.1.20</version>
|
|
68
|
+
<scope>runtime</scope>
|
|
69
|
+
</dependency>
|
|
70
|
+
</dependencies>
|
|
71
|
+
</project>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7580b9e158bec1bfa30df5ba060ce920
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e8085458c8f098f5e9c9d54327c741b7b0019025
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c594b15b03a397a241565d9463a6c923d5640c3f7bd6ac79c675e0ca0ffe13f8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0e3a64774f9f515403044f57fb7e37863190e880a6403b17c4c5c1cdd8b7d6eb3c20d2499b94b2a2963ef4d6af7f3194bc4c00557460135bf00647f7c220c591
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<metadata>
|
|
3
|
+
<groupId>host.exp.exponent</groupId>
|
|
4
|
+
<artifactId>expo.modules.filesystem</artifactId>
|
|
5
|
+
<versioning>
|
|
6
|
+
<latest>18.2.0-canary-20250611-f0afe80</latest>
|
|
7
|
+
<release>18.2.0-canary-20250611-f0afe80</release>
|
|
8
|
+
<versions>
|
|
9
|
+
<version>18.2.0-canary-20250611-f0afe80</version>
|
|
10
|
+
</versions>
|
|
11
|
+
<lastUpdated>20250611221459</lastUpdated>
|
|
12
|
+
</versioning>
|
|
13
|
+
</metadata>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
99f7403f0db043b3803dcf428ae6fcd4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3194ceb9b37c61dbc263a780fd0683acc0690748
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cfa55f422bcc6d2982f8e6c81db34f47259edc1b9a331b7cbddd668bea4b7508
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b118dd795bb8a1b6d82bee321aa08cadaf90e6a58489d80ac50da29a22ea4d11a8775bd4549797debc0ac795c86650ca4c86be07b61f90a3e5b4cbb69fc462ad
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-file-system",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.2.0-canary-20250611-f0afe80",
|
|
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,11 @@
|
|
|
35
35
|
"preset": "expo-module-scripts"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"expo-module-scripts": "
|
|
39
|
-
"jest-expo": "
|
|
38
|
+
"expo-module-scripts": "4.1.8-canary-20250611-f0afe80",
|
|
39
|
+
"jest-expo": "54.0.0-canary-20250611-f0afe80"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"expo": "
|
|
42
|
+
"expo": "54.0.0-canary-20250611-f0afe80",
|
|
43
43
|
"react-native": "*"
|
|
44
|
-
}
|
|
45
|
-
"gitHead": "49c9d53cf0a9fc8179d1c8f5268beadd141f70ca"
|
|
44
|
+
}
|
|
46
45
|
}
|
package/src/FileSystem.ts
CHANGED
|
@@ -286,7 +286,7 @@ export async function downloadAsync(
|
|
|
286
286
|
*
|
|
287
287
|
* **Server**
|
|
288
288
|
*
|
|
289
|
-
*
|
|
289
|
+
* Refer to the "[Server: Handling multipart requests](#server-handling-multipart-requests)" example - there is code for a simple Node.js server.
|
|
290
290
|
* @return Returns a Promise that resolves to `FileSystemUploadResult` object.
|
|
291
291
|
*/
|
|
292
292
|
export async function uploadAsync(
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { isRunningInExpoGo } from 'expo';
|
|
2
2
|
import { NativeModule, requireNativeModule } from 'expo-modules-core';
|
|
3
3
|
|
|
4
|
-
import type { Directory, File } from './ExpoFileSystem.types';
|
|
4
|
+
import type { Directory, File, DownloadOptions } from './ExpoFileSystem.types';
|
|
5
5
|
import ExpoGoFileSystemNextStub from './ExpoGoFileSystemNextStub';
|
|
6
6
|
|
|
7
7
|
declare class ExpoFileSystemNextModule extends NativeModule {
|
|
8
8
|
FileSystemDirectory: typeof Directory;
|
|
9
9
|
FileSystemFile: typeof File;
|
|
10
|
-
downloadFileAsync(
|
|
10
|
+
downloadFileAsync(
|
|
11
|
+
url: string,
|
|
12
|
+
destination: File | Directory,
|
|
13
|
+
options?: DownloadOptions
|
|
14
|
+
): Promise<string>;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export default isRunningInExpoGo()
|
|
@@ -76,6 +76,15 @@ export declare class Directory {
|
|
|
76
76
|
list(): (Directory | File)[];
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
export type DownloadOptions = {
|
|
80
|
+
/**
|
|
81
|
+
* The headers to send with the request.
|
|
82
|
+
*/
|
|
83
|
+
headers?: {
|
|
84
|
+
[key: string]: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
79
88
|
/**
|
|
80
89
|
* Represents a file on the file system.
|
|
81
90
|
*/
|
|
@@ -168,7 +177,11 @@ export declare class File {
|
|
|
168
177
|
* const file = await File.downloadFileAsync("https://example.com/image.png", new Directory(Paths.document));
|
|
169
178
|
* ```
|
|
170
179
|
*/
|
|
171
|
-
static downloadFileAsync(
|
|
180
|
+
static downloadFileAsync(
|
|
181
|
+
url: string,
|
|
182
|
+
destination: Directory | File,
|
|
183
|
+
options?: DownloadOptions
|
|
184
|
+
): Promise<File>;
|
|
172
185
|
|
|
173
186
|
/**
|
|
174
187
|
* A size of the file in bytes. Null if the file does not exist, or it cannot be read.
|
package/src/next/FileSystem.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ExpoFileSystem from './ExpoFileSystem';
|
|
2
|
+
import type { DownloadOptions } from './ExpoFileSystem.types';
|
|
2
3
|
import { PathUtilities } from './pathUtilities';
|
|
3
4
|
import { FileSystemReadableStreamSource, FileSystemWritableSink } from './streams';
|
|
4
5
|
|
|
@@ -20,7 +21,9 @@ export class Paths extends PathUtilities {
|
|
|
20
21
|
const containers: Record<string, string> = ExpoFileSystem.appleSharedContainers ?? {};
|
|
21
22
|
const result: Record<string, Directory> = {};
|
|
22
23
|
for (const appGroupId in containers) {
|
|
23
|
-
|
|
24
|
+
if (containers[appGroupId]) {
|
|
25
|
+
result[appGroupId] = new Directory(containers[appGroupId]);
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
return result;
|
|
26
29
|
}
|
|
@@ -131,8 +134,12 @@ export class File extends ExpoFileSystem.FileSystemFile {
|
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
// Cannot use `static` keyword in class declaration because of a runtime error.
|
|
134
|
-
File.downloadFileAsync = async function downloadFileAsync(
|
|
135
|
-
|
|
137
|
+
File.downloadFileAsync = async function downloadFileAsync(
|
|
138
|
+
url: string,
|
|
139
|
+
to: File | Directory,
|
|
140
|
+
options?: DownloadOptions
|
|
141
|
+
) {
|
|
142
|
+
const outputPath = await ExpoFileSystem.downloadFileAsync(url, to, options);
|
|
136
143
|
return new File(outputPath);
|
|
137
144
|
};
|
|
138
145
|
|
|
@@ -115,12 +115,12 @@ export function resolve(...args: string[]) {
|
|
|
115
115
|
const path = i >= 0 ? args[i] : '';
|
|
116
116
|
|
|
117
117
|
// Skip empty entries
|
|
118
|
-
if (path.length === 0) {
|
|
118
|
+
if (!path || path.length === 0) {
|
|
119
119
|
continue;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
resolvedPath = `${path}/${resolvedPath}`;
|
|
123
|
-
resolvedAbsolute = path.charAt(0) === '/';
|
|
123
|
+
resolvedAbsolute = !!(path && path.charAt(0) === '/');
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// At this point the path should be resolved to a full absolute path, but
|
|
@@ -161,7 +161,7 @@ export function join(...args: string[]) {
|
|
|
161
161
|
const path: string[] = [];
|
|
162
162
|
for (let i = 0; i < args.length; ++i) {
|
|
163
163
|
const arg = args[i];
|
|
164
|
-
if (arg.length > 0) {
|
|
164
|
+
if (arg && arg.length > 0) {
|
|
165
165
|
path.push(arg);
|
|
166
166
|
}
|
|
167
167
|
}
|
package/src/next/streams.ts
CHANGED
|
@@ -37,7 +37,7 @@ export class FileSystemReadableStreamSource implements UnderlyingByteSource {
|
|
|
37
37
|
} else {
|
|
38
38
|
const array = new Uint8Array(theView.buffer);
|
|
39
39
|
for (let i = 0; i < bytes.length; i++) {
|
|
40
|
-
array[i + theView.byteOffset] = bytes[i]
|
|
40
|
+
array[i + (theView.byteOffset ?? 0)] = bytes[i]!;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
controller.byobRequest.respond(bytes.length);
|