expo-file-system 16.0.8 → 17.0.0
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 +19 -7
- package/android/build.gradle +7 -97
- package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +2 -7
- package/build/ExponentFileSystemShim.d.ts.map +1 -1
- package/build/ExponentFileSystemShim.js +0 -3
- package/build/ExponentFileSystemShim.js.map +1 -1
- package/build/FileSystem.d.ts +2 -2
- package/build/FileSystem.d.ts.map +1 -1
- package/build/FileSystem.js +2 -2
- package/build/FileSystem.js.map +1 -1
- package/build/types.d.ts +0 -1
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/ios/EXFileSystemAssetLibraryHandler.m +1 -0
- package/ios/EXFileSystemLocalFileHandler.m +1 -0
- package/ios/ExpoFileSystem.podspec +2 -0
- package/ios/FileSystemModule.swift +2 -0
- package/ios/PrivacyInfo.xcprivacy +34 -0
- package/package.json +3 -3
- package/src/ExponentFileSystemShim.ts +0 -3
- package/src/FileSystem.ts +2 -2
- package/src/types.ts +0 -1
- package/ios/EXFilePermissionModule.h +0 -16
- package/ios/EXFilePermissionModule.m +0 -63
- package/ios/EXFileSystem.h +0 -24
- package/ios/EXFileSystem.m +0 -1085
package/CHANGELOG.md
CHANGED
|
@@ -10,11 +10,23 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## 17.0.0 — 2024-04-18
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [Android] remove `CookieHandler` as it's no longer in the module registry and not necessary. ([#28145](https://github.com/expo/expo/pull/28145) by [@alanjhughes](https://github.com/alanjhughes))
|
|
18
|
+
|
|
19
|
+
### 💡 Others
|
|
20
|
+
|
|
21
|
+
- [iOS] Add privacy manifest describing required reason API usage. ([#27770](https://github.com/expo/expo/pull/27770) by [@aleqsio](https://github.com/aleqsio))
|
|
22
|
+
- drop unused web `name` property. ([#27437](https://github.com/expo/expo/pull/27437) by [@EvanBacon](https://github.com/EvanBacon))
|
|
23
|
+
- Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
|
|
24
|
+
|
|
25
|
+
## 16.0.8 - 2024-03-07
|
|
14
26
|
|
|
15
27
|
_This version does not introduce any user-facing changes._
|
|
16
28
|
|
|
17
|
-
## 16.0.7
|
|
29
|
+
## 16.0.7 - 2024-02-27
|
|
18
30
|
|
|
19
31
|
### 🐛 Bug fixes
|
|
20
32
|
|
|
@@ -22,29 +34,29 @@ _This version does not introduce any user-facing changes._
|
|
|
22
34
|
- On `iOS`, fix an issue with `copyAsync` where the copy fails if it is a photo library asset. ([#27208](https://github.com/expo/expo/pull/27208) by [@alanjhughes](https://github.com/alanjhughes))
|
|
23
35
|
- On `iOS`, resolve the promise manually after copying a PHAsset file. ([#27381](https://github.com/expo/expo/pull/27381) by [@alanjhughes](https://github.com/alanjhughes))
|
|
24
36
|
|
|
25
|
-
## 16.0.6
|
|
37
|
+
## 16.0.6 - 2024-02-06
|
|
26
38
|
|
|
27
39
|
### 🐛 Bug fixes
|
|
28
40
|
|
|
29
41
|
- On `iOS`, fix upload task requests. ([#26880](https://github.com/expo/expo/pull/26880) by [@alanjhughes](https://github.com/alanjhughes))
|
|
30
42
|
|
|
31
|
-
## 16.0.5
|
|
43
|
+
## 16.0.5 - 2024-01-23
|
|
32
44
|
|
|
33
45
|
### 🐛 Bug fixes
|
|
34
46
|
|
|
35
47
|
- On `iOS`, set `httpMethod` on upload requests. ([#26516](https://github.com/expo/expo/pull/26516) by [@alanjhughes](https://github.com/alanjhughes))
|
|
36
48
|
|
|
37
|
-
## 16.0.4
|
|
49
|
+
## 16.0.4 - 2024-01-18
|
|
38
50
|
|
|
39
51
|
_This version does not introduce any user-facing changes._
|
|
40
52
|
|
|
41
|
-
## 16.0.3
|
|
53
|
+
## 16.0.3 - 2024-01-10
|
|
42
54
|
|
|
43
55
|
### 🎉 New features
|
|
44
56
|
|
|
45
57
|
- Added support for macOS platform. ([#26253](https://github.com/expo/expo/pull/26253) by [@tsapeta](https://github.com/tsapeta))
|
|
46
58
|
|
|
47
|
-
## 16.0.2
|
|
59
|
+
## 16.0.2 - 2023-12-19
|
|
48
60
|
|
|
49
61
|
_This version does not introduce any user-facing changes._
|
|
50
62
|
|
package/android/build.gradle
CHANGED
|
@@ -1,114 +1,24 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven-publish'
|
|
4
2
|
|
|
5
3
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '
|
|
4
|
+
version = '17.0.0'
|
|
7
5
|
|
|
8
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
useExpoPublishing()
|
|
15
|
-
useCoreDependencies()
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
buildscript {
|
|
20
|
-
// Simple helper that allows the root project to override versions declared by this library.
|
|
21
|
-
ext.safeExtGet = { prop, fallback ->
|
|
22
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Ensures backward compatibility
|
|
26
|
-
ext.getKotlinVersion = {
|
|
27
|
-
if (ext.has("kotlinVersion")) {
|
|
28
|
-
ext.kotlinVersion()
|
|
29
|
-
} else {
|
|
30
|
-
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
repositories {
|
|
35
|
-
mavenCentral()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
dependencies {
|
|
39
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
44
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
45
|
-
afterEvaluate {
|
|
46
|
-
publishing {
|
|
47
|
-
publications {
|
|
48
|
-
release(MavenPublication) {
|
|
49
|
-
from components.release
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
repositories {
|
|
53
|
-
maven {
|
|
54
|
-
url = mavenLocal().url
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
7
|
+
apply from: expoModulesCorePlugin
|
|
8
|
+
applyKotlinExpoModulesCorePlugin()
|
|
9
|
+
useCoreDependencies()
|
|
10
|
+
useDefaultAndroidSdkVersions()
|
|
11
|
+
useExpoPublishing()
|
|
60
12
|
|
|
61
13
|
android {
|
|
62
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
63
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
64
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
65
|
-
|
|
66
|
-
defaultConfig {
|
|
67
|
-
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
68
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
publishing {
|
|
72
|
-
singleVariant("release") {
|
|
73
|
-
withSourcesJar()
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
lintOptions {
|
|
78
|
-
abortOnError false
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
83
|
-
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
84
|
-
compileOptions {
|
|
85
|
-
sourceCompatibility JavaVersion.VERSION_11
|
|
86
|
-
targetCompatibility JavaVersion.VERSION_11
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
kotlinOptions {
|
|
90
|
-
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
14
|
namespace "expo.modules.filesystem"
|
|
95
15
|
defaultConfig {
|
|
96
16
|
versionCode 30
|
|
97
|
-
versionName "
|
|
17
|
+
versionName "17.0.0"
|
|
98
18
|
}
|
|
99
19
|
}
|
|
100
20
|
|
|
101
|
-
repositories {
|
|
102
|
-
mavenCentral()
|
|
103
|
-
}
|
|
104
|
-
|
|
105
21
|
dependencies {
|
|
106
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
107
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
108
|
-
implementation project(':expo-modules-core')
|
|
109
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
110
|
-
}
|
|
111
|
-
|
|
112
22
|
api 'commons-codec:commons-codec:1.10'
|
|
113
23
|
api 'commons-io:commons-io:1.4'
|
|
114
24
|
api 'com.squareup.okhttp3:okhttp:4.9.2'
|
|
@@ -28,7 +28,6 @@ import kotlinx.coroutines.withContext
|
|
|
28
28
|
import okhttp3.Call
|
|
29
29
|
import okhttp3.Callback
|
|
30
30
|
import okhttp3.Headers
|
|
31
|
-
import okhttp3.JavaNetCookieJar
|
|
32
31
|
import okhttp3.MediaType
|
|
33
32
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|
34
33
|
import okhttp3.MultipartBody
|
|
@@ -54,7 +53,6 @@ import java.io.InputStream
|
|
|
54
53
|
import java.io.OutputStream
|
|
55
54
|
import java.io.OutputStreamWriter
|
|
56
55
|
import java.math.BigInteger
|
|
57
|
-
import java.net.CookieHandler
|
|
58
56
|
import java.net.URLConnection
|
|
59
57
|
import java.util.*
|
|
60
58
|
import java.util.concurrent.TimeUnit
|
|
@@ -368,7 +366,7 @@ open class FileSystemModule : Module() {
|
|
|
368
366
|
}
|
|
369
367
|
}
|
|
370
368
|
|
|
371
|
-
AsyncFunction("getTotalDiskCapacityAsync") {
|
|
369
|
+
AsyncFunction<Double>("getTotalDiskCapacityAsync") {
|
|
372
370
|
val root = StatFs(Environment.getDataDirectory().absolutePath)
|
|
373
371
|
val blockCount = root.blockCountLong
|
|
374
372
|
val blockSize = root.blockSizeLong
|
|
@@ -377,7 +375,7 @@ open class FileSystemModule : Module() {
|
|
|
377
375
|
return@AsyncFunction capacity.toDouble().coerceAtMost(2.0.pow(53.0) - 1)
|
|
378
376
|
}
|
|
379
377
|
|
|
380
|
-
AsyncFunction("getFreeDiskStorageAsync") {
|
|
378
|
+
AsyncFunction<Double>("getFreeDiskStorageAsync") {
|
|
381
379
|
val external = StatFs(Environment.getDataDirectory().absolutePath)
|
|
382
380
|
val availableBlocks = external.availableBlocksLong
|
|
383
381
|
val blockSize = external.blockSizeLong
|
|
@@ -997,10 +995,7 @@ open class FileSystemModule : Module() {
|
|
|
997
995
|
.connectTimeout(60, TimeUnit.SECONDS)
|
|
998
996
|
.readTimeout(60, TimeUnit.SECONDS)
|
|
999
997
|
.writeTimeout(60, TimeUnit.SECONDS)
|
|
1000
|
-
val cookieHandler: CookieHandler = appContext.legacyModule()
|
|
1001
|
-
?: throw CookieHandlerNotFoundException()
|
|
1002
998
|
|
|
1003
|
-
builder.cookieJar(JavaNetCookieJar(cookieHandler))
|
|
1004
999
|
client = builder.build()
|
|
1005
1000
|
}
|
|
1006
1001
|
return client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExponentFileSystemShim.d.ts","sourceRoot":"","sources":["../src/ExponentFileSystemShim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,QAAA,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"ExponentFileSystemShim.d.ts","sourceRoot":"","sources":["../src/ExponentFileSystemShim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,QAAA,MAAM,cAAc,EAAE,wBAYrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExponentFileSystemShim.js","sourceRoot":"","sources":["../src/ExponentFileSystemShim.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAA6B;IAC/C,IAAI,
|
|
1
|
+
{"version":3,"file":"ExponentFileSystemShim.js","sourceRoot":"","sources":["../src/ExponentFileSystemShim.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAA6B;IAC/C,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,WAAW,CAAC,SAAiB,IAAS,CAAC;IACvC,eAAe,CAAC,KAAa,IAAS,CAAC;CACxC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { ExponentFileSystemModule } from './types';\n\nconst platformModule: ExponentFileSystemModule = {\n get documentDirectory(): string | null {\n return null;\n },\n get cacheDirectory(): string | null {\n return null;\n },\n get bundleDirectory(): string | null {\n return null;\n },\n addListener(eventName: string): void {},\n removeListeners(count: number): void {},\n};\n\nexport default platformModule;\n"]}
|
package/build/FileSystem.d.ts
CHANGED
|
@@ -89,13 +89,13 @@ export declare function readDirectoryAsync(fileUri: string): Promise<string[]>;
|
|
|
89
89
|
/**
|
|
90
90
|
* Gets the available internal disk storage size, in bytes. This returns the free space on the data partition that hosts all of the internal storage for all apps on the device.
|
|
91
91
|
* @return Returns a Promise that resolves to the number of bytes available on the internal disk, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
|
|
92
|
-
* if the capacity is greater than 2
|
|
92
|
+
* if the capacity is greater than 2^53^ - 1 bytes.
|
|
93
93
|
*/
|
|
94
94
|
export declare function getFreeDiskStorageAsync(): Promise<number>;
|
|
95
95
|
/**
|
|
96
96
|
* Gets total internal disk storage size, in bytes. This is the total capacity of the data partition that hosts all the internal storage for all apps on the device.
|
|
97
97
|
* @return Returns a Promise that resolves to a number that specifies the total internal disk storage capacity in bytes, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
|
|
98
|
-
* if the capacity is greater than 2
|
|
98
|
+
* if the capacity is greater than 2^53^ - 1 bytes.
|
|
99
99
|
*/
|
|
100
100
|
export declare function getTotalDiskCapacityAsync(): Promise<number>;
|
|
101
101
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../src/FileSystem.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,qCAAqC,EACrC,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EAER,wBAAwB,EACxB,2CAA2C,EAE3C,uBAAuB,EACvB,sBAAsB,EAGtB,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAiB5B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,eAA6D,CAAC;AAE5F;;;;GAIG;AACH,eAAO,MAAM,cAAc,eAA0D,CAAC;AAEtF;;GAEG;AACH,eAAO,MAAM,eAAe,eAA2D,CAAC;AAExF;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAKhG;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,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sB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAKjB;IAED;;OAEG;IACI,MAAM,kBAAkB,kDAAyB,CAAC;IACzD;;OAEG;IACI,MAAM,iBAAiB,iDAAwB,CAAC;IACvD;;OAEG;IACI,MAAM,WAAW,2CAAkB,CAAC;IAC3C;;OAEG;IACI,MAAM,SAAS,yCAAgB,CAAC;IACvC;;OAEG;IACI,MAAM,SAAS,yCAAgB,CAAC;CACxC"}
|
package/build/FileSystem.js
CHANGED
|
@@ -159,7 +159,7 @@ export async function readDirectoryAsync(fileUri) {
|
|
|
159
159
|
/**
|
|
160
160
|
* Gets the available internal disk storage size, in bytes. This returns the free space on the data partition that hosts all of the internal storage for all apps on the device.
|
|
161
161
|
* @return Returns a Promise that resolves to the number of bytes available on the internal disk, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
|
|
162
|
-
* if the capacity is greater than 2
|
|
162
|
+
* if the capacity is greater than 2^53^ - 1 bytes.
|
|
163
163
|
*/
|
|
164
164
|
export async function getFreeDiskStorageAsync() {
|
|
165
165
|
if (!ExponentFileSystem.getFreeDiskStorageAsync) {
|
|
@@ -170,7 +170,7 @@ export async function getFreeDiskStorageAsync() {
|
|
|
170
170
|
/**
|
|
171
171
|
* Gets total internal disk storage size, in bytes. This is the total capacity of the data partition that hosts all the internal storage for all apps on the device.
|
|
172
172
|
* @return Returns a Promise that resolves to a number that specifies the total internal disk storage capacity in bytes, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
|
|
173
|
-
* if the capacity is greater than 2
|
|
173
|
+
* if the capacity is greater than 2^53^ - 1 bytes.
|
|
174
174
|
*/
|
|
175
175
|
export async function getTotalDiskCapacityAsync() {
|
|
176
176
|
if (!ExponentFileSystem.getTotalDiskCapacityAsync) {
|
package/build/FileSystem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../src/FileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,mBAAmB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAUL,qBAAqB,EAGrB,oBAAoB,GAQrB,MAAM,oBAAoB,CAAC;AAE5B,IAAI,CAAC,kBAAkB,EAAE;IACvB,OAAO,CAAC,IAAI,CACV,2GAA2G,CAC5G,CAAC;CACH;AACD,qCAAqC;AACrC,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,sBAAsB;AAE5E,SAAS,oBAAoB,CAAC,CAAgB;IAC5C,IAAI,CAAC,IAAI,IAAI,EAAE;QACb,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;KACpC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAE5F;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAEtF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAe,EAAE,UAAuB,EAAE;IAC3E,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE;QACpC,MAAM,IA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C3C;;OAEG;IACU,gCAAS,GAAG,aAAa,CAAC;IACvC;;OAEG;IACU,gCAAS,GAAG,aAAa,CAAC;AACzC,CAAC,EApGgB,sBAAsB,KAAtB,sBAAsB,QAoGtC","sourcesContent":["import { EventEmitter, Subscription, UnavailabilityError, uuid } from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nimport ExponentFileSystem from './ExponentFileSystem';\nimport {\n DownloadOptions,\n DownloadPauseState,\n FileSystemNetworkTaskProgressCallback,\n DownloadProgressData,\n UploadProgressData,\n FileInfo,\n FileSystemAcceptedUploadHttpMethod,\n FileSystemDownloadResult,\n FileSystemRequestDirectoryPermissionsResult,\n FileSystemSessionType,\n FileSystemUploadOptions,\n FileSystemUploadResult,\n FileSystemUploadType,\n ProgressEvent,\n ReadingOptions,\n WritingOptions,\n DeletingOptions,\n InfoOptions,\n RelocatingOptions,\n MakeDirectoryOptions,\n} from './FileSystem.types';\n\nif (!ExponentFileSystem) {\n console.warn(\n \"No native ExponentFileSystem module found, are you sure the expo-file-system's module is linked properly?\"\n );\n}\n// Prevent webpack from pruning this.\nconst _unused = new EventEmitter(ExponentFileSystem); // eslint-disable-line\n\nfunction normalizeEndingSlash(p: string | null): string | null {\n if (p != null) {\n return p.replace(/\\/*$/, '') + '/';\n }\n return null;\n}\n\n/**\n * `file://` URI pointing to the directory where user documents for this app will be stored.\n * Files stored here will remain until explicitly deleted by the app. Ends with a trailing `/`.\n * Example uses are for files the user saves that they expect to see again.\n */\nexport const documentDirectory = normalizeEndingSlash(ExponentFileSystem.documentDirectory);\n\n/**\n * `file://` URI pointing to the directory where temporary files used by this app will be stored.\n * Files stored here may be automatically deleted by the system when low on storage.\n * Example uses are for downloaded or generated files that the app just needs for one-time usage.\n */\nexport const cacheDirectory = normalizeEndingSlash(ExponentFileSystem.cacheDirectory);\n\n/**\n * URI to the directory where assets bundled with the application are stored.\n */\nexport const bundleDirectory = normalizeEndingSlash(ExponentFileSystem.bundleDirectory);\n\n/**\n * Get metadata information about a file, directory or external content/asset.\n * @param fileUri URI to the file or directory. See [supported URI schemes](#supported-uri-schemes).\n * @param options A map of options represented by [`InfoOptions`](#infooptions) type.\n * @return A Promise that resolves to a `FileInfo` object. If no item exists at this URI,\n * the returned Promise resolves to `FileInfo` object in form of `{ exists: false, isDirectory: false }`.\n */\nexport async function getInfoAsync(fileUri: string, options: InfoOptions = {}): Promise<FileInfo> {\n if (!ExponentFileSystem.getInfoAsync) {\n throw new UnavailabilityError('expo-file-system', 'getInfoAsync');\n }\n return await ExponentFileSystem.getInfoAsync(fileUri, options);\n}\n\n/**\n * Read the entire contents of a file as a string. Binary will be returned in raw format, you will need to append `data:image/png;base64,` to use it as Base64.\n * @param fileUri `file://` or [SAF](#saf-uri) URI to the file or directory.\n * @param options A map of read options represented by [`ReadingOptions`](#readingoptions) type.\n * @return A Promise that resolves to a string containing the entire contents of the file.\n */\nexport async function readAsStringAsync(\n fileUri: string,\n options: ReadingOptions = {}\n): Promise<string> {\n if (!ExponentFileSystem.readAsStringAsync) {\n throw new UnavailabilityError('expo-file-system', 'readAsStringAsync');\n }\n return await ExponentFileSystem.readAsStringAsync(fileUri, options);\n}\n\n/**\n * Takes a `file://` URI and converts it into content URI (`content://`) so that it can be accessed by other applications outside of Expo.\n * @param fileUri The local URI of the file. If there is no file at this URI, an exception will be thrown.\n * @example\n * ```js\n * FileSystem.getContentUriAsync(uri).then(cUri => {\n * console.log(cUri);\n * IntentLauncher.startActivityAsync('android.intent.action.VIEW', {\n * data: cUri,\n * flags: 1,\n * });\n * });\n * ```\n * @return Returns a Promise that resolves to a `string` containing a `content://` URI pointing to the file.\n * The URI is the same as the `fileUri` input parameter but in a different format.\n * @platform android\n */\nexport async function getContentUriAsync(fileUri: string): Promise<string> {\n if (Platform.OS === 'android') {\n if (!ExponentFileSystem.getContentUriAsync) {\n throw new UnavailabilityError('expo-file-system', 'getContentUriAsync');\n }\n return await ExponentFileSystem.getContentUriAsync(fileUri);\n } else {\n return fileUri;\n }\n}\n\n/**\n * Write the entire contents of a file as a string.\n * @param fileUri `file://` or [SAF](#saf-uri) URI to the file or directory.\n * > Note: when you're using SAF URI the file needs to exist. You can't create a new file.\n * @param contents The string to replace the contents of the file with.\n * @param options A map of write options represented by [`WritingOptions`](#writingoptions) type.\n */\nexport async function writeAsStringAsync(\n fileUri: string,\n contents: string,\n options: WritingOptions = {}\n): Promise<void> {\n if (!ExponentFileSystem.writeAsStringAsync) {\n throw new UnavailabilityError('expo-file-system', 'writeAsStringAsync');\n }\n return await ExponentFileSystem.writeAsStringAsync(fileUri, contents, options);\n}\n\n/**\n * Delete a file or directory. If the URI points to a directory, the directory and all its contents are recursively deleted.\n * @param fileUri `file://` or [SAF](#saf-uri) URI to the file or directory.\n * @param options A map of write options represented by [`DeletingOptions`](#deletingoptions) type.\n */\nexport async function deleteAsync(fileUri: string, options: DeletingOptions = {}): Promise<void> {\n if (!ExponentFileSystem.deleteAsync) {\n throw new UnavailabilityError('expo-file-system', 'deleteAsync');\n }\n return await ExponentFileSystem.deleteAsync(fileUri, options);\n}\n\nexport async function deleteLegacyDocumentDirectoryAndroid(): Promise<void> {\n if (Platform.OS !== 'android' || documentDirectory == null) {\n return;\n }\n const legacyDocumentDirectory = `${documentDirectory}ExperienceData/`;\n return await deleteAsync(legacyDocumentDirectory, { idempotent: true });\n}\n\n/**\n * Move a file or directory to a new location.\n * @param options A map of move options represented by [`RelocatingOptions`](#relocatingoptions) type.\n */\nexport async function moveAsync(options: RelocatingOptions): Promise<void> {\n if (!ExponentFileSystem.moveAsync) {\n throw new UnavailabilityError('expo-file-system', 'moveAsync');\n }\n return await ExponentFileSystem.moveAsync(options);\n}\n\n/**\n * Create a copy of a file or directory. Directories are recursively copied with all of their contents.\n * It can be also used to copy content shared by other apps to local filesystem.\n * @param options A map of move options represented by [`RelocatingOptions`](#relocatingoptions) type.\n */\nexport async function copyAsync(options: RelocatingOptions): Promise<void> {\n if (!ExponentFileSystem.copyAsync) {\n throw new UnavailabilityError('expo-file-system', 'copyAsync');\n }\n return await ExponentFileSystem.copyAsync(options);\n}\n\n/**\n * Create a new empty directory.\n * @param fileUri `file://` URI to the new directory to create.\n * @param options A map of create directory options represented by [`MakeDirectoryOptions`](#makedirectoryoptions) type.\n */\nexport async function makeDirectoryAsync(\n fileUri: string,\n options: MakeDirectoryOptions = {}\n): Promise<void> {\n if (!ExponentFileSystem.makeDirectoryAsync) {\n throw new UnavailabilityError('expo-file-system', 'makeDirectoryAsync');\n }\n return await ExponentFileSystem.makeDirectoryAsync(fileUri, options);\n}\n\n/**\n * Enumerate the contents of a directory.\n * @param fileUri `file://` URI to the directory.\n * @return A Promise that resolves to an array of strings, each containing the name of a file or directory contained in the directory at `fileUri`.\n */\nexport async function readDirectoryAsync(fileUri: string): Promise<string[]> {\n if (!ExponentFileSystem.readDirectoryAsync) {\n throw new UnavailabilityError('expo-file-system', 'readDirectoryAsync');\n }\n return await ExponentFileSystem.readDirectoryAsync(fileUri);\n}\n\n/**\n * Gets the available internal disk storage size, in bytes. This returns the free space on the data partition that hosts all of the internal storage for all apps on the device.\n * @return Returns a Promise that resolves to the number of bytes available on the internal disk, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\n * if the capacity is greater than 2<sup>53</sup> - 1 bytes.\n */\nexport async function getFreeDiskStorageAsync(): Promise<number> {\n if (!ExponentFileSystem.getFreeDiskStorageAsync) {\n throw new UnavailabilityError('expo-file-system', 'getFreeDiskStorageAsync');\n }\n return await ExponentFileSystem.getFreeDiskStorageAsync();\n}\n\n/**\n * Gets total internal disk storage size, in bytes. This is the total capacity of the data partition that hosts all the internal storage for all apps on the device.\n * @return Returns a Promise that resolves to a number that specifies the total internal disk storage capacity in bytes, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\n * if the capacity is greater than 2<sup>53</sup> - 1 bytes.\n */\nexport async function getTotalDiskCapacityAsync(): Promise<number> {\n if (!ExponentFileSystem.getTotalDiskCapacityAsync) {\n throw new UnavailabilityError('expo-file-system', 'getTotalDiskCapacityAsync');\n }\n return await ExponentFileSystem.getTotalDiskCapacityAsync();\n}\n\n/**\n * Download the contents at a remote URI to a file in the app's file system. The directory for a local file uri must exist prior to calling this function.\n * @param uri The remote URI to download from.\n * @param fileUri The local URI of the file to download to. If there is no file at this URI, a new one is created.\n * If there is a file at this URI, its contents are replaced. The directory for the file must exist.\n * @param options A map of download options represented by [`DownloadOptions`](#downloadoptions) type.\n * @example\n * ```js\n * FileSystem.downloadAsync(\n * 'http://techslides.com/demos/sample-videos/small.mp4',\n * FileSystem.documentDirectory + 'small.mp4'\n * )\n * .then(({ uri }) => {\n * console.log('Finished downloading to ', uri);\n * })\n * .catch(error => {\n * console.error(error);\n * });\n * ```\n * @return Returns a Promise that resolves to a `FileSystemDownloadResult` object.\n */\nexport async function downloadAsync(\n uri: string,\n fileUri: string,\n options: DownloadOptions = {}\n): Promise<FileSystemDownloadResult> {\n if (!ExponentFileSystem.downloadAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadAsync');\n }\n\n return await ExponentFileSystem.downloadAsync(uri, fileUri, {\n sessionType: FileSystemSessionType.BACKGROUND,\n ...options,\n });\n}\n\n/**\n * Upload the contents of the file pointed by `fileUri` to the remote url.\n * @param url The remote URL, where the file will be sent.\n * @param fileUri The local URI of the file to send. The file must exist.\n * @param options A map of download options represented by [`FileSystemUploadOptions`](#filesystemuploadoptions) type.\n * @example\n * **Client**\n *\n * ```js\n * import * as FileSystem from 'expo-file-system';\n *\n * try {\n * const response = await FileSystem.uploadAsync(`http://192.168.0.1:1234/binary-upload`, fileUri, {\n * fieldName: 'file',\n * httpMethod: 'PATCH',\n * uploadType: FileSystem.FileSystemUploadType.BINARY_CONTENT,\n * });\n * console.log(JSON.stringify(response, null, 4));\n * } catch (error) {\n * console.log(error);\n * }\n * ```\n *\n * **Server**\n *\n * Please refer to the \"[Server: Handling multipart requests](#server-handling-multipart-requests)\" example - there is code for a simple Node.js server.\n * @return Returns a Promise that resolves to `FileSystemUploadResult` object.\n */\nexport async function uploadAsync(\n url: string,\n fileUri: string,\n options: FileSystemUploadOptions = {}\n): Promise<FileSystemUploadResult> {\n if (!ExponentFileSystem.uploadAsync) {\n throw new UnavailabilityError('expo-file-system', 'uploadAsync');\n }\n\n return await ExponentFileSystem.uploadAsync(url, fileUri, {\n sessionType: FileSystemSessionType.BACKGROUND,\n uploadType: FileSystemUploadType.BINARY_CONTENT,\n ...options,\n httpMethod: (options.httpMethod || 'POST').toUpperCase(),\n });\n}\n\n/**\n * Create a `DownloadResumable` object which can start, pause, and resume a download of contents at a remote URI to a file in the app's file system.\n * > Note: You need to call `downloadAsync()`, on a `DownloadResumable` instance to initiate the download.\n * The `DownloadResumable` object has a callback that provides download progress updates.\n * Downloads can be resumed across app restarts by using `AsyncStorage` to store the `DownloadResumable.savable()` object for later retrieval.\n * The `savable` object contains the arguments required to initialize a new `DownloadResumable` object to resume the download after an app restart.\n * The directory for a local file uri must exist prior to calling this function.\n * @param uri The remote URI to download from.\n * @param fileUri The local URI of the file to download to. If there is no file at this URI, a new one is created.\n * If there is a file at this URI, its contents are replaced. The directory for the file must exist.\n * @param options A map of download options represented by [`DownloadOptions`](#downloadoptions) type.\n * @param callback This function is called on each data write to update the download progress.\n * > **Note**: When the app has been moved to the background, this callback won't be fired until it's moved to the foreground.\n * @param resumeData The string which allows the api to resume a paused download. This is set on the `DownloadResumable` object automatically when a download is paused.\n * When initializing a new `DownloadResumable` this should be `null`.\n */\nexport function createDownloadResumable(\n uri: string,\n fileUri: string,\n options?: DownloadOptions,\n callback?: FileSystemNetworkTaskProgressCallback<DownloadProgressData>,\n resumeData?: string\n): DownloadResumable {\n return new DownloadResumable(uri, fileUri, options, callback, resumeData);\n}\n\nexport function createUploadTask(\n url: string,\n fileUri: string,\n options?: FileSystemUploadOptions,\n callback?: FileSystemNetworkTaskProgressCallback<UploadProgressData>\n): UploadTask {\n return new UploadTask(url, fileUri, options, callback);\n}\n\nexport abstract class FileSystemCancellableNetworkTask<\n T extends DownloadProgressData | UploadProgressData,\n> {\n private _uuid = uuid.v4();\n protected taskWasCanceled = false;\n private emitter = new EventEmitter(ExponentFileSystem);\n private subscription?: Subscription | null;\n\n // @docsMissing\n public async cancelAsync(): Promise<void> {\n if (!ExponentFileSystem.networkTaskCancelAsync) {\n throw new UnavailabilityError('expo-file-system', 'networkTaskCancelAsync');\n }\n\n this.removeSubscription();\n this.taskWasCanceled = true;\n return await ExponentFileSystem.networkTaskCancelAsync(this.uuid);\n }\n\n protected isTaskCancelled(): boolean {\n if (this.taskWasCanceled) {\n console.warn('This task was already canceled.');\n return true;\n }\n\n return false;\n }\n\n protected get uuid(): string {\n return this._uuid;\n }\n\n protected abstract getEventName(): string;\n\n protected abstract getCallback(): FileSystemNetworkTaskProgressCallback<T> | undefined;\n\n protected addSubscription() {\n if (this.subscription) {\n return;\n }\n\n this.subscription = this.emitter.addListener(this.getEventName(), (event: ProgressEvent<T>) => {\n if (event.uuid === this.uuid) {\n const callback = this.getCallback();\n if (callback) {\n callback(event.data);\n }\n }\n });\n }\n\n protected removeSubscription() {\n if (!this.subscription) {\n return;\n }\n this.emitter.removeSubscription(this.subscription);\n this.subscription = null;\n }\n}\n\nexport class UploadTask extends FileSystemCancellableNetworkTask<UploadProgressData> {\n private options: FileSystemUploadOptions;\n\n constructor(\n private url: string,\n private fileUri: string,\n options?: FileSystemUploadOptions,\n private callback?: FileSystemNetworkTaskProgressCallback<UploadProgressData>\n ) {\n super();\n\n const httpMethod = (options?.httpMethod?.toUpperCase() ||\n 'POST') as FileSystemAcceptedUploadHttpMethod;\n\n this.options = {\n sessionType: FileSystemSessionType.BACKGROUND,\n uploadType: FileSystemUploadType.BINARY_CONTENT,\n ...options,\n httpMethod,\n };\n }\n\n protected getEventName(): string {\n return 'expo-file-system.uploadProgress';\n }\n protected getCallback(): FileSystemNetworkTaskProgressCallback<UploadProgressData> | undefined {\n return this.callback;\n }\n\n // @docsMissing\n public async uploadAsync(): Promise<FileSystemUploadResult | undefined> {\n if (!ExponentFileSystem.uploadTaskStartAsync) {\n throw new UnavailabilityError('expo-file-system', 'uploadTaskStartAsync');\n }\n\n if (this.isTaskCancelled()) {\n return;\n }\n\n this.addSubscription();\n const result = await ExponentFileSystem.uploadTaskStartAsync(\n this.url,\n this.fileUri,\n this.uuid,\n this.options\n );\n this.removeSubscription();\n\n return result;\n }\n}\n\nexport class DownloadResumable extends FileSystemCancellableNetworkTask<DownloadProgressData> {\n constructor(\n private url: string,\n private _fileUri: string,\n private options: DownloadOptions = {},\n private callback?: FileSystemNetworkTaskProgressCallback<DownloadProgressData>,\n private resumeData?: string\n ) {\n super();\n }\n\n public get fileUri(): string {\n return this._fileUri;\n }\n\n protected getEventName(): string {\n return 'expo-file-system.downloadProgress';\n }\n\n protected getCallback(): FileSystemNetworkTaskProgressCallback<DownloadProgressData> | undefined {\n return this.callback;\n }\n\n /**\n * Download the contents at a remote URI to a file in the app's file system.\n * @return Returns a Promise that resolves to `FileSystemDownloadResult` object, or to `undefined` when task was cancelled.\n */\n async downloadAsync(): Promise<FileSystemDownloadResult | undefined> {\n if (!ExponentFileSystem.downloadResumableStartAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadResumableStartAsync');\n }\n\n if (this.isTaskCancelled()) {\n return;\n }\n\n this.addSubscription();\n return await ExponentFileSystem.downloadResumableStartAsync(\n this.url,\n this._fileUri,\n this.uuid,\n this.options,\n this.resumeData\n );\n }\n\n /**\n * Pause the current download operation. `resumeData` is added to the `DownloadResumable` object after a successful pause operation.\n * Returns an object that can be saved with `AsyncStorage` for future retrieval (the same object that is returned from calling `FileSystem.DownloadResumable.savable()`).\n * @return Returns a Promise that resolves to `DownloadPauseState` object.\n */\n async pauseAsync(): Promise<DownloadPauseState> {\n if (!ExponentFileSystem.downloadResumablePauseAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadResumablePauseAsync');\n }\n\n if (this.isTaskCancelled()) {\n return {\n fileUri: this._fileUri,\n options: this.options,\n url: this.url,\n };\n }\n\n const pauseResult = await ExponentFileSystem.downloadResumablePauseAsync(this.uuid);\n this.removeSubscription();\n if (pauseResult) {\n this.resumeData = pauseResult.resumeData;\n return this.savable();\n } else {\n throw new Error('Unable to generate a savable pause state');\n }\n }\n\n /**\n * Resume a paused download operation.\n * @return Returns a Promise that resolves to `FileSystemDownloadResult` object, or to `undefined` when task was cancelled.\n */\n async resumeAsync(): Promise<FileSystemDownloadResult | undefined> {\n if (!ExponentFileSystem.downloadResumableStartAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadResumableStartAsync');\n }\n\n if (this.isTaskCancelled()) {\n return;\n }\n\n this.addSubscription();\n return await ExponentFileSystem.downloadResumableStartAsync(\n this.url,\n this.fileUri,\n this.uuid,\n this.options,\n this.resumeData\n );\n }\n\n /**\n * Method to get the object which can be saved with `AsyncStorage` for future retrieval.\n * @returns Returns object in shape of `DownloadPauseState` type.\n */\n savable(): DownloadPauseState {\n return {\n url: this.url,\n fileUri: this.fileUri,\n options: this.options,\n resumeData: this.resumeData,\n };\n }\n}\n\nconst baseReadAsStringAsync = readAsStringAsync;\nconst baseWriteAsStringAsync = writeAsStringAsync;\nconst baseDeleteAsync = deleteAsync;\nconst baseMoveAsync = moveAsync;\nconst baseCopyAsync = copyAsync;\n\n/**\n * The `StorageAccessFramework` is a namespace inside of the `expo-file-system` module, which encapsulates all functions which can be used with [SAF URIs](#saf-uri).\n * You can read more about SAF in the [Android documentation](https://developer.android.com/guide/topics/providers/document-provider).\n *\n * @example\n * # Basic Usage\n *\n * ```ts\n * import { StorageAccessFramework } from 'expo-file-system';\n *\n * // Requests permissions for external directory\n * const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync();\n *\n * if (permissions.granted) {\n * // Gets SAF URI from response\n * const uri = permissions.directoryUri;\n *\n * // Gets all files inside of selected directory\n * const files = await StorageAccessFramework.readDirectoryAsync(uri);\n * alert(`Files inside ${uri}:\\n\\n${JSON.stringify(files)}`);\n * }\n * ```\n *\n * # Migrating an album\n *\n * ```ts\n * import * as MediaLibrary from 'expo-media-library';\n * import * as FileSystem from 'expo-file-system';\n * const { StorageAccessFramework } = FileSystem;\n *\n * async function migrateAlbum(albumName: string) {\n * // Gets SAF URI to the album\n * const albumUri = StorageAccessFramework.getUriForDirectoryInRoot(albumName);\n *\n * // Requests permissions\n * const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync(albumUri);\n * if (!permissions.granted) {\n * return;\n * }\n *\n * const permittedUri = permissions.directoryUri;\n * // Checks if users selected the correct folder\n * if (!permittedUri.includes(albumName)) {\n * return;\n * }\n *\n * const mediaLibraryPermissions = await MediaLibrary.requestPermissionsAsync();\n * if (!mediaLibraryPermissions.granted) {\n * return;\n * }\n *\n * // Moves files from external storage to internal storage\n * await StorageAccessFramework.moveAsync({\n * from: permittedUri,\n * to: FileSystem.documentDirectory!,\n * });\n *\n * const outputDir = FileSystem.documentDirectory! + albumName;\n * const migratedFiles = await FileSystem.readDirectoryAsync(outputDir);\n *\n * // Creates assets from local files\n * const [newAlbumCreator, ...assets] = await Promise.all(\n * migratedFiles.map<Promise<MediaLibrary.Asset>>(\n * async fileName => await MediaLibrary.createAssetAsync(outputDir + '/' + fileName)\n * )\n * );\n *\n * // Album was empty\n * if (!newAlbumCreator) {\n * return;\n * }\n *\n * // Creates a new album in the scoped directory\n * const newAlbum = await MediaLibrary.createAlbumAsync(albumName, newAlbumCreator, false);\n * if (assets.length) {\n * await MediaLibrary.addAssetsToAlbumAsync(assets, newAlbum, false);\n * }\n * }\n * ```\n * @platform Android\n */\nexport namespace StorageAccessFramework {\n /**\n * Gets a [SAF URI](#saf-uri) pointing to a folder in the Android root directory. You can use this function to get URI for\n * `StorageAccessFramework.requestDirectoryPermissionsAsync()` when you trying to migrate an album. In that case, the name of the album is the folder name.\n * @param folderName The name of the folder which is located in the Android root directory.\n * @return Returns a [SAF URI](#saf-uri) to a folder.\n */\n export function getUriForDirectoryInRoot(folderName: string) {\n return `content://com.android.externalstorage.documents/tree/primary:${folderName}/document/primary:${folderName}`;\n }\n\n /**\n * Allows users to select a specific directory, granting your app access to all of the files and sub-directories within that directory.\n * @param initialFileUrl The [SAF URI](#saf-uri) of the directory that the file picker should display when it first loads.\n * If URI is incorrect or points to a non-existing folder, it's ignored.\n * @platform android 11+\n * @return Returns a Promise that resolves to `FileSystemRequestDirectoryPermissionsResult` object.\n */\n export async function requestDirectoryPermissionsAsync(\n initialFileUrl: string | null = null\n ): Promise<FileSystemRequestDirectoryPermissionsResult> {\n if (!ExponentFileSystem.requestDirectoryPermissionsAsync) {\n throw new UnavailabilityError(\n 'expo-file-system',\n 'StorageAccessFramework.requestDirectoryPermissionsAsync'\n );\n }\n\n return await ExponentFileSystem.requestDirectoryPermissionsAsync(initialFileUrl);\n }\n\n /**\n * Enumerate the contents of a directory.\n * @param dirUri [SAF](#saf-uri) URI to the directory.\n * @return A Promise that resolves to an array of strings, each containing the full [SAF URI](#saf-uri) of a file or directory contained in the directory at `fileUri`.\n */\n export async function readDirectoryAsync(dirUri: string): Promise<string[]> {\n if (!ExponentFileSystem.readSAFDirectoryAsync) {\n throw new UnavailabilityError(\n 'expo-file-system',\n 'StorageAccessFramework.readDirectoryAsync'\n );\n }\n return await ExponentFileSystem.readSAFDirectoryAsync(dirUri);\n }\n\n /**\n * Creates a new empty directory.\n * @param parentUri The [SAF](#saf-uri) URI to the parent directory.\n * @param dirName The name of new directory.\n * @return A Promise that resolves to a [SAF URI](#saf-uri) to the created directory.\n */\n export async function makeDirectoryAsync(parentUri: string, dirName: string): Promise<string> {\n if (!ExponentFileSystem.makeSAFDirectoryAsync) {\n throw new UnavailabilityError(\n 'expo-file-system',\n 'StorageAccessFramework.makeDirectoryAsync'\n );\n }\n return await ExponentFileSystem.makeSAFDirectoryAsync(parentUri, dirName);\n }\n\n /**\n * Creates a new empty file.\n * @param parentUri The [SAF](#saf-uri) URI to the parent directory.\n * @param fileName The name of new file **without the extension**.\n * @param mimeType The MIME type of new file.\n * @return A Promise that resolves to a [SAF URI](#saf-uri) to the created file.\n */\n export async function createFileAsync(\n parentUri: string,\n fileName: string,\n mimeType: string\n ): Promise<string> {\n if (!ExponentFileSystem.createSAFFileAsync) {\n throw new UnavailabilityError('expo-file-system', 'StorageAccessFramework.createFileAsync');\n }\n return await ExponentFileSystem.createSAFFileAsync(parentUri, fileName, mimeType);\n }\n\n /**\n * Alias for [`writeAsStringAsync`](#filesystemwriteasstringasyncfileuri-contents-options) method.\n */\n export const writeAsStringAsync = baseWriteAsStringAsync;\n /**\n * Alias for [`readAsStringAsync`](#filesystemreadasstringasyncfileuri-options) method.\n */\n export const readAsStringAsync = baseReadAsStringAsync;\n /**\n * Alias for [`deleteAsync`](#filesystemdeleteasyncfileuri-options) method.\n */\n export const deleteAsync = baseDeleteAsync;\n /**\n * Alias for [`moveAsync`](#filesystemmoveasyncoptions) method.\n */\n export const moveAsync = baseMoveAsync;\n /**\n * Alias for [`copyAsync`](#filesystemcopyasyncoptions) method.\n */\n export const copyAsync = baseCopyAsync;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../src/FileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,mBAAmB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAUL,qBAAqB,EAGrB,oBAAoB,GAQrB,MAAM,oBAAoB,CAAC;AAE5B,IAAI,CAAC,kBAAkB,EAAE,CAAC;IACxB,OAAO,CAAC,IAAI,CACV,2GAA2G,CAC5G,CAAC;AACJ,CAAC;AACD,qCAAqC;AACrC,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,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cesContent":["import { EventEmitter, Subscription, UnavailabilityError, uuid } from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nimport ExponentFileSystem from './ExponentFileSystem';\nimport {\n DownloadOptions,\n DownloadPauseState,\n FileSystemNetworkTaskProgressCallback,\n DownloadProgressData,\n UploadProgressData,\n FileInfo,\n FileSystemAcceptedUploadHttpMethod,\n FileSystemDownloadResult,\n FileSystemRequestDirectoryPermissionsResult,\n FileSystemSessionType,\n FileSystemUploadOptions,\n FileSystemUploadResult,\n FileSystemUploadType,\n ProgressEvent,\n ReadingOptions,\n WritingOptions,\n DeletingOptions,\n InfoOptions,\n RelocatingOptions,\n MakeDirectoryOptions,\n} from './FileSystem.types';\n\nif (!ExponentFileSystem) {\n console.warn(\n \"No native ExponentFileSystem module found, are you sure the expo-file-system's module is linked properly?\"\n );\n}\n// Prevent webpack from pruning this.\nconst _unused = new EventEmitter(ExponentFileSystem); // eslint-disable-line\n\nfunction normalizeEndingSlash(p: string | null): string | null {\n if (p != null) {\n return p.replace(/\\/*$/, '') + '/';\n }\n return null;\n}\n\n/**\n * `file://` URI pointing to the directory where user documents for this app will be stored.\n * Files stored here will remain until explicitly deleted by the app. Ends with a trailing `/`.\n * Example uses are for files the user saves that they expect to see again.\n */\nexport const documentDirectory = normalizeEndingSlash(ExponentFileSystem.documentDirectory);\n\n/**\n * `file://` URI pointing to the directory where temporary files used by this app will be stored.\n * Files stored here may be automatically deleted by the system when low on storage.\n * Example uses are for downloaded or generated files that the app just needs for one-time usage.\n */\nexport const cacheDirectory = normalizeEndingSlash(ExponentFileSystem.cacheDirectory);\n\n/**\n * URI to the directory where assets bundled with the application are stored.\n */\nexport const bundleDirectory = normalizeEndingSlash(ExponentFileSystem.bundleDirectory);\n\n/**\n * Get metadata information about a file, directory or external content/asset.\n * @param fileUri URI to the file or directory. See [supported URI schemes](#supported-uri-schemes).\n * @param options A map of options represented by [`InfoOptions`](#infooptions) type.\n * @return A Promise that resolves to a `FileInfo` object. If no item exists at this URI,\n * the returned Promise resolves to `FileInfo` object in form of `{ exists: false, isDirectory: false }`.\n */\nexport async function getInfoAsync(fileUri: string, options: InfoOptions = {}): Promise<FileInfo> {\n if (!ExponentFileSystem.getInfoAsync) {\n throw new UnavailabilityError('expo-file-system', 'getInfoAsync');\n }\n return await ExponentFileSystem.getInfoAsync(fileUri, options);\n}\n\n/**\n * Read the entire contents of a file as a string. Binary will be returned in raw format, you will need to append `data:image/png;base64,` to use it as Base64.\n * @param fileUri `file://` or [SAF](#saf-uri) URI to the file or directory.\n * @param options A map of read options represented by [`ReadingOptions`](#readingoptions) type.\n * @return A Promise that resolves to a string containing the entire contents of the file.\n */\nexport async function readAsStringAsync(\n fileUri: string,\n options: ReadingOptions = {}\n): Promise<string> {\n if (!ExponentFileSystem.readAsStringAsync) {\n throw new UnavailabilityError('expo-file-system', 'readAsStringAsync');\n }\n return await ExponentFileSystem.readAsStringAsync(fileUri, options);\n}\n\n/**\n * Takes a `file://` URI and converts it into content URI (`content://`) so that it can be accessed by other applications outside of Expo.\n * @param fileUri The local URI of the file. If there is no file at this URI, an exception will be thrown.\n * @example\n * ```js\n * FileSystem.getContentUriAsync(uri).then(cUri => {\n * console.log(cUri);\n * IntentLauncher.startActivityAsync('android.intent.action.VIEW', {\n * data: cUri,\n * flags: 1,\n * });\n * });\n * ```\n * @return Returns a Promise that resolves to a `string` containing a `content://` URI pointing to the file.\n * The URI is the same as the `fileUri` input parameter but in a different format.\n * @platform android\n */\nexport async function getContentUriAsync(fileUri: string): Promise<string> {\n if (Platform.OS === 'android') {\n if (!ExponentFileSystem.getContentUriAsync) {\n throw new UnavailabilityError('expo-file-system', 'getContentUriAsync');\n }\n return await ExponentFileSystem.getContentUriAsync(fileUri);\n } else {\n return fileUri;\n }\n}\n\n/**\n * Write the entire contents of a file as a string.\n * @param fileUri `file://` or [SAF](#saf-uri) URI to the file or directory.\n * > Note: when you're using SAF URI the file needs to exist. You can't create a new file.\n * @param contents The string to replace the contents of the file with.\n * @param options A map of write options represented by [`WritingOptions`](#writingoptions) type.\n */\nexport async function writeAsStringAsync(\n fileUri: string,\n contents: string,\n options: WritingOptions = {}\n): Promise<void> {\n if (!ExponentFileSystem.writeAsStringAsync) {\n throw new UnavailabilityError('expo-file-system', 'writeAsStringAsync');\n }\n return await ExponentFileSystem.writeAsStringAsync(fileUri, contents, options);\n}\n\n/**\n * Delete a file or directory. If the URI points to a directory, the directory and all its contents are recursively deleted.\n * @param fileUri `file://` or [SAF](#saf-uri) URI to the file or directory.\n * @param options A map of write options represented by [`DeletingOptions`](#deletingoptions) type.\n */\nexport async function deleteAsync(fileUri: string, options: DeletingOptions = {}): Promise<void> {\n if (!ExponentFileSystem.deleteAsync) {\n throw new UnavailabilityError('expo-file-system', 'deleteAsync');\n }\n return await ExponentFileSystem.deleteAsync(fileUri, options);\n}\n\nexport async function deleteLegacyDocumentDirectoryAndroid(): Promise<void> {\n if (Platform.OS !== 'android' || documentDirectory == null) {\n return;\n }\n const legacyDocumentDirectory = `${documentDirectory}ExperienceData/`;\n return await deleteAsync(legacyDocumentDirectory, { idempotent: true });\n}\n\n/**\n * Move a file or directory to a new location.\n * @param options A map of move options represented by [`RelocatingOptions`](#relocatingoptions) type.\n */\nexport async function moveAsync(options: RelocatingOptions): Promise<void> {\n if (!ExponentFileSystem.moveAsync) {\n throw new UnavailabilityError('expo-file-system', 'moveAsync');\n }\n return await ExponentFileSystem.moveAsync(options);\n}\n\n/**\n * Create a copy of a file or directory. Directories are recursively copied with all of their contents.\n * It can be also used to copy content shared by other apps to local filesystem.\n * @param options A map of move options represented by [`RelocatingOptions`](#relocatingoptions) type.\n */\nexport async function copyAsync(options: RelocatingOptions): Promise<void> {\n if (!ExponentFileSystem.copyAsync) {\n throw new UnavailabilityError('expo-file-system', 'copyAsync');\n }\n return await ExponentFileSystem.copyAsync(options);\n}\n\n/**\n * Create a new empty directory.\n * @param fileUri `file://` URI to the new directory to create.\n * @param options A map of create directory options represented by [`MakeDirectoryOptions`](#makedirectoryoptions) type.\n */\nexport async function makeDirectoryAsync(\n fileUri: string,\n options: MakeDirectoryOptions = {}\n): Promise<void> {\n if (!ExponentFileSystem.makeDirectoryAsync) {\n throw new UnavailabilityError('expo-file-system', 'makeDirectoryAsync');\n }\n return await ExponentFileSystem.makeDirectoryAsync(fileUri, options);\n}\n\n/**\n * Enumerate the contents of a directory.\n * @param fileUri `file://` URI to the directory.\n * @return A Promise that resolves to an array of strings, each containing the name of a file or directory contained in the directory at `fileUri`.\n */\nexport async function readDirectoryAsync(fileUri: string): Promise<string[]> {\n if (!ExponentFileSystem.readDirectoryAsync) {\n throw new UnavailabilityError('expo-file-system', 'readDirectoryAsync');\n }\n return await ExponentFileSystem.readDirectoryAsync(fileUri);\n}\n\n/**\n * Gets the available internal disk storage size, in bytes. This returns the free space on the data partition that hosts all of the internal storage for all apps on the device.\n * @return Returns a Promise that resolves to the number of bytes available on the internal disk, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\n * if the capacity is greater than 2^53^ - 1 bytes.\n */\nexport async function getFreeDiskStorageAsync(): Promise<number> {\n if (!ExponentFileSystem.getFreeDiskStorageAsync) {\n throw new UnavailabilityError('expo-file-system', 'getFreeDiskStorageAsync');\n }\n return await ExponentFileSystem.getFreeDiskStorageAsync();\n}\n\n/**\n * Gets total internal disk storage size, in bytes. This is the total capacity of the data partition that hosts all the internal storage for all apps on the device.\n * @return Returns a Promise that resolves to a number that specifies the total internal disk storage capacity in bytes, or JavaScript's [`MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\n * if the capacity is greater than 2^53^ - 1 bytes.\n */\nexport async function getTotalDiskCapacityAsync(): Promise<number> {\n if (!ExponentFileSystem.getTotalDiskCapacityAsync) {\n throw new UnavailabilityError('expo-file-system', 'getTotalDiskCapacityAsync');\n }\n return await ExponentFileSystem.getTotalDiskCapacityAsync();\n}\n\n/**\n * Download the contents at a remote URI to a file in the app's file system. The directory for a local file uri must exist prior to calling this function.\n * @param uri The remote URI to download from.\n * @param fileUri The local URI of the file to download to. If there is no file at this URI, a new one is created.\n * If there is a file at this URI, its contents are replaced. The directory for the file must exist.\n * @param options A map of download options represented by [`DownloadOptions`](#downloadoptions) type.\n * @example\n * ```js\n * FileSystem.downloadAsync(\n * 'http://techslides.com/demos/sample-videos/small.mp4',\n * FileSystem.documentDirectory + 'small.mp4'\n * )\n * .then(({ uri }) => {\n * console.log('Finished downloading to ', uri);\n * })\n * .catch(error => {\n * console.error(error);\n * });\n * ```\n * @return Returns a Promise that resolves to a `FileSystemDownloadResult` object.\n */\nexport async function downloadAsync(\n uri: string,\n fileUri: string,\n options: DownloadOptions = {}\n): Promise<FileSystemDownloadResult> {\n if (!ExponentFileSystem.downloadAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadAsync');\n }\n\n return await ExponentFileSystem.downloadAsync(uri, fileUri, {\n sessionType: FileSystemSessionType.BACKGROUND,\n ...options,\n });\n}\n\n/**\n * Upload the contents of the file pointed by `fileUri` to the remote url.\n * @param url The remote URL, where the file will be sent.\n * @param fileUri The local URI of the file to send. The file must exist.\n * @param options A map of download options represented by [`FileSystemUploadOptions`](#filesystemuploadoptions) type.\n * @example\n * **Client**\n *\n * ```js\n * import * as FileSystem from 'expo-file-system';\n *\n * try {\n * const response = await FileSystem.uploadAsync(`http://192.168.0.1:1234/binary-upload`, fileUri, {\n * fieldName: 'file',\n * httpMethod: 'PATCH',\n * uploadType: FileSystem.FileSystemUploadType.BINARY_CONTENT,\n * });\n * console.log(JSON.stringify(response, null, 4));\n * } catch (error) {\n * console.log(error);\n * }\n * ```\n *\n * **Server**\n *\n * Please refer to the \"[Server: Handling multipart requests](#server-handling-multipart-requests)\" example - there is code for a simple Node.js server.\n * @return Returns a Promise that resolves to `FileSystemUploadResult` object.\n */\nexport async function uploadAsync(\n url: string,\n fileUri: string,\n options: FileSystemUploadOptions = {}\n): Promise<FileSystemUploadResult> {\n if (!ExponentFileSystem.uploadAsync) {\n throw new UnavailabilityError('expo-file-system', 'uploadAsync');\n }\n\n return await ExponentFileSystem.uploadAsync(url, fileUri, {\n sessionType: FileSystemSessionType.BACKGROUND,\n uploadType: FileSystemUploadType.BINARY_CONTENT,\n ...options,\n httpMethod: (options.httpMethod || 'POST').toUpperCase(),\n });\n}\n\n/**\n * Create a `DownloadResumable` object which can start, pause, and resume a download of contents at a remote URI to a file in the app's file system.\n * > Note: You need to call `downloadAsync()`, on a `DownloadResumable` instance to initiate the download.\n * The `DownloadResumable` object has a callback that provides download progress updates.\n * Downloads can be resumed across app restarts by using `AsyncStorage` to store the `DownloadResumable.savable()` object for later retrieval.\n * The `savable` object contains the arguments required to initialize a new `DownloadResumable` object to resume the download after an app restart.\n * The directory for a local file uri must exist prior to calling this function.\n * @param uri The remote URI to download from.\n * @param fileUri The local URI of the file to download to. If there is no file at this URI, a new one is created.\n * If there is a file at this URI, its contents are replaced. The directory for the file must exist.\n * @param options A map of download options represented by [`DownloadOptions`](#downloadoptions) type.\n * @param callback This function is called on each data write to update the download progress.\n * > **Note**: When the app has been moved to the background, this callback won't be fired until it's moved to the foreground.\n * @param resumeData The string which allows the api to resume a paused download. This is set on the `DownloadResumable` object automatically when a download is paused.\n * When initializing a new `DownloadResumable` this should be `null`.\n */\nexport function createDownloadResumable(\n uri: string,\n fileUri: string,\n options?: DownloadOptions,\n callback?: FileSystemNetworkTaskProgressCallback<DownloadProgressData>,\n resumeData?: string\n): DownloadResumable {\n return new DownloadResumable(uri, fileUri, options, callback, resumeData);\n}\n\nexport function createUploadTask(\n url: string,\n fileUri: string,\n options?: FileSystemUploadOptions,\n callback?: FileSystemNetworkTaskProgressCallback<UploadProgressData>\n): UploadTask {\n return new UploadTask(url, fileUri, options, callback);\n}\n\nexport abstract class FileSystemCancellableNetworkTask<\n T extends DownloadProgressData | UploadProgressData,\n> {\n private _uuid = uuid.v4();\n protected taskWasCanceled = false;\n private emitter = new EventEmitter(ExponentFileSystem);\n private subscription?: Subscription | null;\n\n // @docsMissing\n public async cancelAsync(): Promise<void> {\n if (!ExponentFileSystem.networkTaskCancelAsync) {\n throw new UnavailabilityError('expo-file-system', 'networkTaskCancelAsync');\n }\n\n this.removeSubscription();\n this.taskWasCanceled = true;\n return await ExponentFileSystem.networkTaskCancelAsync(this.uuid);\n }\n\n protected isTaskCancelled(): boolean {\n if (this.taskWasCanceled) {\n console.warn('This task was already canceled.');\n return true;\n }\n\n return false;\n }\n\n protected get uuid(): string {\n return this._uuid;\n }\n\n protected abstract getEventName(): string;\n\n protected abstract getCallback(): FileSystemNetworkTaskProgressCallback<T> | undefined;\n\n protected addSubscription() {\n if (this.subscription) {\n return;\n }\n\n this.subscription = this.emitter.addListener(this.getEventName(), (event: ProgressEvent<T>) => {\n if (event.uuid === this.uuid) {\n const callback = this.getCallback();\n if (callback) {\n callback(event.data);\n }\n }\n });\n }\n\n protected removeSubscription() {\n if (!this.subscription) {\n return;\n }\n this.emitter.removeSubscription(this.subscription);\n this.subscription = null;\n }\n}\n\nexport class UploadTask extends FileSystemCancellableNetworkTask<UploadProgressData> {\n private options: FileSystemUploadOptions;\n\n constructor(\n private url: string,\n private fileUri: string,\n options?: FileSystemUploadOptions,\n private callback?: FileSystemNetworkTaskProgressCallback<UploadProgressData>\n ) {\n super();\n\n const httpMethod = (options?.httpMethod?.toUpperCase() ||\n 'POST') as FileSystemAcceptedUploadHttpMethod;\n\n this.options = {\n sessionType: FileSystemSessionType.BACKGROUND,\n uploadType: FileSystemUploadType.BINARY_CONTENT,\n ...options,\n httpMethod,\n };\n }\n\n protected getEventName(): string {\n return 'expo-file-system.uploadProgress';\n }\n protected getCallback(): FileSystemNetworkTaskProgressCallback<UploadProgressData> | undefined {\n return this.callback;\n }\n\n // @docsMissing\n public async uploadAsync(): Promise<FileSystemUploadResult | undefined> {\n if (!ExponentFileSystem.uploadTaskStartAsync) {\n throw new UnavailabilityError('expo-file-system', 'uploadTaskStartAsync');\n }\n\n if (this.isTaskCancelled()) {\n return;\n }\n\n this.addSubscription();\n const result = await ExponentFileSystem.uploadTaskStartAsync(\n this.url,\n this.fileUri,\n this.uuid,\n this.options\n );\n this.removeSubscription();\n\n return result;\n }\n}\n\nexport class DownloadResumable extends FileSystemCancellableNetworkTask<DownloadProgressData> {\n constructor(\n private url: string,\n private _fileUri: string,\n private options: DownloadOptions = {},\n private callback?: FileSystemNetworkTaskProgressCallback<DownloadProgressData>,\n private resumeData?: string\n ) {\n super();\n }\n\n public get fileUri(): string {\n return this._fileUri;\n }\n\n protected getEventName(): string {\n return 'expo-file-system.downloadProgress';\n }\n\n protected getCallback(): FileSystemNetworkTaskProgressCallback<DownloadProgressData> | undefined {\n return this.callback;\n }\n\n /**\n * Download the contents at a remote URI to a file in the app's file system.\n * @return Returns a Promise that resolves to `FileSystemDownloadResult` object, or to `undefined` when task was cancelled.\n */\n async downloadAsync(): Promise<FileSystemDownloadResult | undefined> {\n if (!ExponentFileSystem.downloadResumableStartAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadResumableStartAsync');\n }\n\n if (this.isTaskCancelled()) {\n return;\n }\n\n this.addSubscription();\n return await ExponentFileSystem.downloadResumableStartAsync(\n this.url,\n this._fileUri,\n this.uuid,\n this.options,\n this.resumeData\n );\n }\n\n /**\n * Pause the current download operation. `resumeData` is added to the `DownloadResumable` object after a successful pause operation.\n * Returns an object that can be saved with `AsyncStorage` for future retrieval (the same object that is returned from calling `FileSystem.DownloadResumable.savable()`).\n * @return Returns a Promise that resolves to `DownloadPauseState` object.\n */\n async pauseAsync(): Promise<DownloadPauseState> {\n if (!ExponentFileSystem.downloadResumablePauseAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadResumablePauseAsync');\n }\n\n if (this.isTaskCancelled()) {\n return {\n fileUri: this._fileUri,\n options: this.options,\n url: this.url,\n };\n }\n\n const pauseResult = await ExponentFileSystem.downloadResumablePauseAsync(this.uuid);\n this.removeSubscription();\n if (pauseResult) {\n this.resumeData = pauseResult.resumeData;\n return this.savable();\n } else {\n throw new Error('Unable to generate a savable pause state');\n }\n }\n\n /**\n * Resume a paused download operation.\n * @return Returns a Promise that resolves to `FileSystemDownloadResult` object, or to `undefined` when task was cancelled.\n */\n async resumeAsync(): Promise<FileSystemDownloadResult | undefined> {\n if (!ExponentFileSystem.downloadResumableStartAsync) {\n throw new UnavailabilityError('expo-file-system', 'downloadResumableStartAsync');\n }\n\n if (this.isTaskCancelled()) {\n return;\n }\n\n this.addSubscription();\n return await ExponentFileSystem.downloadResumableStartAsync(\n this.url,\n this.fileUri,\n this.uuid,\n this.options,\n this.resumeData\n );\n }\n\n /**\n * Method to get the object which can be saved with `AsyncStorage` for future retrieval.\n * @returns Returns object in shape of `DownloadPauseState` type.\n */\n savable(): DownloadPauseState {\n return {\n url: this.url,\n fileUri: this.fileUri,\n options: this.options,\n resumeData: this.resumeData,\n };\n }\n}\n\nconst baseReadAsStringAsync = readAsStringAsync;\nconst baseWriteAsStringAsync = writeAsStringAsync;\nconst baseDeleteAsync = deleteAsync;\nconst baseMoveAsync = moveAsync;\nconst baseCopyAsync = copyAsync;\n\n/**\n * The `StorageAccessFramework` is a namespace inside of the `expo-file-system` module, which encapsulates all functions which can be used with [SAF URIs](#saf-uri).\n * You can read more about SAF in the [Android documentation](https://developer.android.com/guide/topics/providers/document-provider).\n *\n * @example\n * # Basic Usage\n *\n * ```ts\n * import { StorageAccessFramework } from 'expo-file-system';\n *\n * // Requests permissions for external directory\n * const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync();\n *\n * if (permissions.granted) {\n * // Gets SAF URI from response\n * const uri = permissions.directoryUri;\n *\n * // Gets all files inside of selected directory\n * const files = await StorageAccessFramework.readDirectoryAsync(uri);\n * alert(`Files inside ${uri}:\\n\\n${JSON.stringify(files)}`);\n * }\n * ```\n *\n * # Migrating an album\n *\n * ```ts\n * import * as MediaLibrary from 'expo-media-library';\n * import * as FileSystem from 'expo-file-system';\n * const { StorageAccessFramework } = FileSystem;\n *\n * async function migrateAlbum(albumName: string) {\n * // Gets SAF URI to the album\n * const albumUri = StorageAccessFramework.getUriForDirectoryInRoot(albumName);\n *\n * // Requests permissions\n * const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync(albumUri);\n * if (!permissions.granted) {\n * return;\n * }\n *\n * const permittedUri = permissions.directoryUri;\n * // Checks if users selected the correct folder\n * if (!permittedUri.includes(albumName)) {\n * return;\n * }\n *\n * const mediaLibraryPermissions = await MediaLibrary.requestPermissionsAsync();\n * if (!mediaLibraryPermissions.granted) {\n * return;\n * }\n *\n * // Moves files from external storage to internal storage\n * await StorageAccessFramework.moveAsync({\n * from: permittedUri,\n * to: FileSystem.documentDirectory!,\n * });\n *\n * const outputDir = FileSystem.documentDirectory! + albumName;\n * const migratedFiles = await FileSystem.readDirectoryAsync(outputDir);\n *\n * // Creates assets from local files\n * const [newAlbumCreator, ...assets] = await Promise.all(\n * migratedFiles.map<Promise<MediaLibrary.Asset>>(\n * async fileName => await MediaLibrary.createAssetAsync(outputDir + '/' + fileName)\n * )\n * );\n *\n * // Album was empty\n * if (!newAlbumCreator) {\n * return;\n * }\n *\n * // Creates a new album in the scoped directory\n * const newAlbum = await MediaLibrary.createAlbumAsync(albumName, newAlbumCreator, false);\n * if (assets.length) {\n * await MediaLibrary.addAssetsToAlbumAsync(assets, newAlbum, false);\n * }\n * }\n * ```\n * @platform Android\n */\nexport namespace StorageAccessFramework {\n /**\n * Gets a [SAF URI](#saf-uri) pointing to a folder in the Android root directory. You can use this function to get URI for\n * `StorageAccessFramework.requestDirectoryPermissionsAsync()` when you trying to migrate an album. In that case, the name of the album is the folder name.\n * @param folderName The name of the folder which is located in the Android root directory.\n * @return Returns a [SAF URI](#saf-uri) to a folder.\n */\n export function getUriForDirectoryInRoot(folderName: string) {\n return `content://com.android.externalstorage.documents/tree/primary:${folderName}/document/primary:${folderName}`;\n }\n\n /**\n * Allows users to select a specific directory, granting your app access to all of the files and sub-directories within that directory.\n * @param initialFileUrl The [SAF URI](#saf-uri) of the directory that the file picker should display when it first loads.\n * If URI is incorrect or points to a non-existing folder, it's ignored.\n * @platform android 11+\n * @return Returns a Promise that resolves to `FileSystemRequestDirectoryPermissionsResult` object.\n */\n export async function requestDirectoryPermissionsAsync(\n initialFileUrl: string | null = null\n ): Promise<FileSystemRequestDirectoryPermissionsResult> {\n if (!ExponentFileSystem.requestDirectoryPermissionsAsync) {\n throw new UnavailabilityError(\n 'expo-file-system',\n 'StorageAccessFramework.requestDirectoryPermissionsAsync'\n );\n }\n\n return await ExponentFileSystem.requestDirectoryPermissionsAsync(initialFileUrl);\n }\n\n /**\n * Enumerate the contents of a directory.\n * @param dirUri [SAF](#saf-uri) URI to the directory.\n * @return A Promise that resolves to an array of strings, each containing the full [SAF URI](#saf-uri) of a file or directory contained in the directory at `fileUri`.\n */\n export async function readDirectoryAsync(dirUri: string): Promise<string[]> {\n if (!ExponentFileSystem.readSAFDirectoryAsync) {\n throw new UnavailabilityError(\n 'expo-file-system',\n 'StorageAccessFramework.readDirectoryAsync'\n );\n }\n return await ExponentFileSystem.readSAFDirectoryAsync(dirUri);\n }\n\n /**\n * Creates a new empty directory.\n * @param parentUri The [SAF](#saf-uri) URI to the parent directory.\n * @param dirName The name of new directory.\n * @return A Promise that resolves to a [SAF URI](#saf-uri) to the created directory.\n */\n export async function makeDirectoryAsync(parentUri: string, dirName: string): Promise<string> {\n if (!ExponentFileSystem.makeSAFDirectoryAsync) {\n throw new UnavailabilityError(\n 'expo-file-system',\n 'StorageAccessFramework.makeDirectoryAsync'\n );\n }\n return await ExponentFileSystem.makeSAFDirectoryAsync(parentUri, dirName);\n }\n\n /**\n * Creates a new empty file.\n * @param parentUri The [SAF](#saf-uri) URI to the parent directory.\n * @param fileName The name of new file **without the extension**.\n * @param mimeType The MIME type of new file.\n * @return A Promise that resolves to a [SAF URI](#saf-uri) to the created file.\n */\n export async function createFileAsync(\n parentUri: string,\n fileName: string,\n mimeType: string\n ): Promise<string> {\n if (!ExponentFileSystem.createSAFFileAsync) {\n throw new UnavailabilityError('expo-file-system', 'StorageAccessFramework.createFileAsync');\n }\n return await ExponentFileSystem.createSAFFileAsync(parentUri, fileName, mimeType);\n }\n\n /**\n * Alias for [`writeAsStringAsync`](#filesystemwriteasstringasyncfileuri-contents-options) method.\n */\n export const writeAsStringAsync = baseWriteAsStringAsync;\n /**\n * Alias for [`readAsStringAsync`](#filesystemreadasstringasyncfileuri-options) method.\n */\n export const readAsStringAsync = baseReadAsStringAsync;\n /**\n * Alias for [`deleteAsync`](#filesystemdeleteasyncfileuri-options) method.\n */\n export const deleteAsync = baseDeleteAsync;\n /**\n * Alias for [`moveAsync`](#filesystemmoveasyncoptions) method.\n */\n export const moveAsync = baseMoveAsync;\n /**\n * Alias for [`copyAsync`](#filesystemcopyasyncoptions) method.\n */\n export const copyAsync = baseCopyAsync;\n}\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
type PlatformMethod = (...args: any[]) => Promise<any>;
|
|
2
2
|
export interface ExponentFileSystemModule {
|
|
3
|
-
readonly name: 'ExponentFileSystem';
|
|
4
3
|
readonly documentDirectory: string | null;
|
|
5
4
|
readonly cacheDirectory: string | null;
|
|
6
5
|
readonly bundleDirectory: string | null;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEvD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,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EAAE,cAAc,CAAC;IACjD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC;IAC/C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C"}
|
package/build/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["type PlatformMethod = (...args: any[]) => Promise<any>;\n\nexport interface ExponentFileSystemModule {\n readonly
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["type PlatformMethod = (...args: any[]) => Promise<any>;\n\nexport interface ExponentFileSystemModule {\n readonly documentDirectory: string | null;\n readonly cacheDirectory: string | null;\n readonly bundleDirectory: string | null;\n readonly getInfoAsync?: PlatformMethod;\n readonly readAsStringAsync?: PlatformMethod;\n readonly writeAsStringAsync?: PlatformMethod;\n readonly deleteAsync?: PlatformMethod;\n readonly moveAsync?: PlatformMethod;\n readonly copyAsync?: PlatformMethod;\n readonly makeDirectoryAsync?: PlatformMethod;\n readonly readDirectoryAsync?: PlatformMethod;\n readonly downloadAsync?: PlatformMethod;\n readonly uploadAsync?: PlatformMethod;\n readonly downloadResumableStartAsync?: PlatformMethod;\n readonly downloadResumablePauseAsync?: PlatformMethod;\n readonly getContentUriAsync?: PlatformMethod;\n readonly getFreeDiskStorageAsync?: PlatformMethod;\n readonly getTotalDiskCapacityAsync?: PlatformMethod;\n readonly requestDirectoryPermissionsAsync?: PlatformMethod;\n readonly readSAFDirectoryAsync?: PlatformMethod;\n readonly makeSAFDirectoryAsync?: PlatformMethod;\n readonly createSAFFileAsync?: PlatformMethod;\n readonly networkTaskCancelAsync?: PlatformMethod;\n readonly uploadTaskStartAsync?: PlatformMethod;\n startObserving?: () => void;\n stopObserving?: () => void;\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n}\n"]}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
result[@"exists"] = @(YES);
|
|
24
24
|
result[@"isDirectory"] = @(NO);
|
|
25
25
|
result[@"uri"] = fileUri;
|
|
26
|
+
// Uses required reason API based on the following reason: 3B52.1
|
|
26
27
|
result[@"modificationTime"] = @(asset.modificationDate.timeIntervalSince1970);
|
|
27
28
|
if (options[@"md5"] || options[@"size"]) {
|
|
28
29
|
[[PHImageManager defaultManager] requestImageDataAndOrientationForAsset:asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, CGImagePropertyOrientation orientation, NSDictionary * _Nullable info) {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
result[@"md5"] = [[NSData dataWithContentsOfFile:path] md5String];
|
|
22
22
|
}
|
|
23
23
|
result[@"size"] = @([EXFileSystemLocalFileHandler getFileSize:path attributes:attributes]);
|
|
24
|
+
// Uses required reason API based on the following reason: 0A2A.1
|
|
24
25
|
result[@"modificationTime"] = @(attributes.fileModificationDate.timeIntervalSince1970);
|
|
25
26
|
resolve(result);
|
|
26
27
|
} else {
|
|
@@ -256,6 +256,7 @@ public final class FileSystemModule: Module {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
AsyncFunction("getFreeDiskStorageAsync") { () -> Int in
|
|
259
|
+
// Uses required reason API based on the following reason: E174.1 85F4.1
|
|
259
260
|
let resourceValues = try getResourceValues(from: documentDirectory, forKeys: [.volumeAvailableCapacityKey])
|
|
260
261
|
|
|
261
262
|
guard let availableCapacity = resourceValues?.volumeAvailableCapacity else {
|
|
@@ -265,6 +266,7 @@ public final class FileSystemModule: Module {
|
|
|
265
266
|
}
|
|
266
267
|
|
|
267
268
|
AsyncFunction("getTotalDiskCapacityAsync") { () -> Int in
|
|
269
|
+
// Uses required reason API based on the following reason: E174.1 85F4.1
|
|
268
270
|
let resourceValues = try getResourceValues(from: documentDirectory, forKeys: [.volumeTotalCapacityKey])
|
|
269
271
|
|
|
270
272
|
guard let totalCapacity = resourceValues?.volumeTotalCapacity else {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>NSPrivacyCollectedDataTypes</key>
|
|
6
|
+
<array>
|
|
7
|
+
</array>
|
|
8
|
+
<key>NSPrivacyTracking</key>
|
|
9
|
+
<false/>
|
|
10
|
+
<key>NSPrivacyTrackingDomains</key>
|
|
11
|
+
<array/>
|
|
12
|
+
<key>NSPrivacyAccessedAPITypes</key>
|
|
13
|
+
<array>
|
|
14
|
+
<dict>
|
|
15
|
+
<key>NSPrivacyAccessedAPIType</key>
|
|
16
|
+
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
|
17
|
+
<key>NSPrivacyAccessedAPITypeReasons</key>
|
|
18
|
+
<array>
|
|
19
|
+
<string>0A2A.1</string>
|
|
20
|
+
<string>3B52.1</string>
|
|
21
|
+
</array>
|
|
22
|
+
</dict>
|
|
23
|
+
<dict>
|
|
24
|
+
<key>NSPrivacyAccessedAPIType</key>
|
|
25
|
+
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
|
|
26
|
+
<key>NSPrivacyAccessedAPITypeReasons</key>
|
|
27
|
+
<array>
|
|
28
|
+
<string>E174.1</string>
|
|
29
|
+
<string>85F4.1</string>
|
|
30
|
+
</array>
|
|
31
|
+
</dict>
|
|
32
|
+
</array>
|
|
33
|
+
</dict>
|
|
34
|
+
</plist>
|