expo-file-system 19.0.2 → 19.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/filesystem/FilePickerContract.kt +71 -0
  4. package/android/src/main/java/expo/modules/filesystem/FileSystemExceptions.kt +2 -4
  5. package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +25 -0
  6. package/android/src/main/java/expo/modules/filesystem/unifiedfile/SAFDocumentFile.kt +25 -14
  7. package/build/ExpoFileSystem.d.ts +2 -0
  8. package/build/ExpoFileSystem.d.ts.map +1 -1
  9. package/build/ExpoFileSystem.types.d.ts +34 -6
  10. package/build/ExpoFileSystem.types.d.ts.map +1 -1
  11. package/build/FileSystem.d.ts.map +1 -1
  12. package/expo-module.config.json +1 -1
  13. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.2/expo.modules.filesystem-19.0.2-sources.jar → 19.0.4/expo.modules.filesystem-19.0.4-sources.jar} +0 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4-sources.jar.md5 +1 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4-sources.jar.sha1 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4-sources.jar.sha256 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4-sources.jar.sha512 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.aar +0 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.aar.md5 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.aar.sha1 +1 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.aar.sha256 +1 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.aar.sha512 +1 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.2/expo.modules.filesystem-19.0.2.module → 19.0.4/expo.modules.filesystem-19.0.4.module} +22 -22
  24. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.module.md5 +1 -0
  25. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.module.sha1 +1 -0
  26. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.module.sha256 +1 -0
  27. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.module.sha512 +1 -0
  28. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/{19.0.2/expo.modules.filesystem-19.0.2.pom → 19.0.4/expo.modules.filesystem-19.0.4.pom} +1 -1
  29. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.pom.md5 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.pom.sha1 +1 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.pom.sha256 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.4/expo.modules.filesystem-19.0.4.pom.sha512 +1 -0
  33. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml +4 -4
  34. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.md5 +1 -1
  35. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha1 +1 -1
  36. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha256 +1 -1
  37. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/maven-metadata.xml.sha512 +1 -1
  38. package/package.json +3 -3
  39. package/src/ExpoFileSystem.ts +2 -0
  40. package/src/ExpoFileSystem.types.ts +36 -6
  41. package/src/FileSystem.ts +10 -0
  42. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2-sources.jar.md5 +0 -1
  43. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2-sources.jar.sha1 +0 -1
  44. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2-sources.jar.sha256 +0 -1
  45. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2-sources.jar.sha512 +0 -1
  46. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.aar +0 -0
  47. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.aar.md5 +0 -1
  48. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.aar.sha1 +0 -1
  49. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.aar.sha256 +0 -1
  50. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.aar.sha512 +0 -1
  51. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.module.md5 +0 -1
  52. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.module.sha1 +0 -1
  53. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.module.sha256 +0 -1
  54. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.module.sha512 +0 -1
  55. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.pom.md5 +0 -1
  56. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.pom.sha1 +0 -1
  57. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.pom.sha256 +0 -1
  58. package/local-maven-repo/host/exp/exponent/expo.modules.filesystem/19.0.2/expo.modules.filesystem-19.0.2.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 19.0.4 — 2025-08-21
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 19.0.3 — 2025-08-18
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fixed type definition for `textSync()` to return `string` instead of `Promise<string>` ([#38898](https://github.com/expo/expo/pull/38898) by [@LeonDvlpmnt](https://github.com/LeonDvlpmnt))
22
+
13
23
  ## 19.0.2 — 2025-08-16
14
24
 
15
25
  _This version does not introduce any user-facing changes._
@@ -28,6 +38,7 @@ _This version does not introduce any user-facing changes._
28
38
 
29
39
  ### 🎉 New features
30
40
 
41
+ - [android] Add file and directory pickers. ([#38455](https://github.com/expo/expo/pull/38455) by [@aleqsio](https://github.com/aleqsio))
31
42
  - Add support for asset uris. ([#38785](https://github.com/expo/expo/pull/38785) by [@aleqsio](https://github.com/aleqsio))
32
43
  - Make file implement blob interface directly. ([#38160](https://github.com/expo/expo/pull/38160) by [@aleqsio](https://github.com/aleqsio))
33
44
  - Add directory info function ([#37910](https://github.com/expo/expo/pull/37910) by [@Wenszel](https://github.com/Wenszel))
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '19.0.2'
7
+ version = '19.0.4'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.filesystem"
11
11
  defaultConfig {
12
12
  versionCode 30
13
- versionName "19.0.2"
13
+ versionName "19.0.4"
14
14
  }
15
15
  }
16
16
 
@@ -0,0 +1,71 @@
1
+ package expo.modules.filesystem
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.app.Activity
5
+ import android.content.ContentResolver
6
+ import android.content.Context
7
+ import android.content.Intent
8
+ import android.net.Uri
9
+ import android.os.Build
10
+ import android.provider.DocumentsContract
11
+ import expo.modules.kotlin.activityresult.AppContextActivityResultContract
12
+ import expo.modules.kotlin.providers.AppContextProvider
13
+ import java.io.Serializable
14
+
15
+ @SuppressLint("WrongConstant")
16
+ internal class FilePickerContract(private val appContextProvider: AppContextProvider) : AppContextActivityResultContract<FilePickerContractOptions, FilePickerContractResult> {
17
+ private val contentResolver: ContentResolver
18
+ get() = requireNotNull(appContextProvider.appContext.reactContext) {
19
+ "React Application Context is null"
20
+ }.contentResolver
21
+
22
+ override fun createIntent(context: Context, input: FilePickerContractOptions): Intent =
23
+ if (input.pickerType == PickerType.FILE) {
24
+ Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
25
+ // if no type is set no intent handler is found – just android things
26
+ type = input.mimeType ?: "*/*"
27
+ }
28
+ } else {
29
+ Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
30
+ }.also { intent ->
31
+ // intent.addCategory(Intent.CATEGORY_OPENABLE)
32
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
33
+ input.initialUri.let { intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, it) }
34
+ }
35
+ }
36
+
37
+ override fun parseResult(input: FilePickerContractOptions, resultCode: Int, intent: Intent?): FilePickerContractResult =
38
+ if (resultCode == Activity.RESULT_CANCELED || intent == null) {
39
+ FilePickerContractResult.Cancelled
40
+ } else {
41
+ val uri = intent.data
42
+ val takeFlags = (intent.flags.and((Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)))
43
+ uri?.let {
44
+ contentResolver.takePersistableUriPermission(it, takeFlags)
45
+ }
46
+ when (input.pickerType) {
47
+ PickerType.DIRECTORY -> FilePickerContractResult.Success(
48
+ FileSystemDirectory(
49
+ uri
50
+ ?: Uri.EMPTY
51
+ )
52
+ )
53
+
54
+ PickerType.FILE -> {
55
+ FilePickerContractResult.Success(FileSystemFile(uri ?: Uri.EMPTY))
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ internal data class FilePickerContractOptions(val initialUri: Uri?, val mimeType: String? = null, val pickerType: PickerType = PickerType.FILE) : Serializable
62
+
63
+ internal enum class PickerType {
64
+ FILE,
65
+ DIRECTORY
66
+ }
67
+
68
+ internal sealed class FilePickerContractResult {
69
+ class Success(val path: FileSystemPath) : FilePickerContractResult()
70
+ object Cancelled : FilePickerContractResult()
71
+ }
@@ -44,10 +44,8 @@ internal class UnableToWriteHandleException(reason: String) :
44
44
  "Unable to write to a file handle: '$reason'"
45
45
  )
46
46
 
47
- internal class UnableToGetInfoException(reason: String) :
48
- CodedException(
49
- "Unable to get info from a file: '$reason'"
50
- )
47
+ internal class PickerCancelledException :
48
+ CodedException("The file picker was cancelled by the user")
51
49
 
52
50
  internal class DestinationAlreadyExistsException :
53
51
  CodedException(
@@ -4,6 +4,7 @@ import android.content.Context
4
4
  import android.net.Uri
5
5
  import android.webkit.URLUtil
6
6
  import expo.modules.interfaces.filesystem.Permission
7
+ import expo.modules.kotlin.activityresult.AppContextActivityResultLauncher
7
8
  import expo.modules.kotlin.apifeatures.EitherType
8
9
  import expo.modules.kotlin.devtools.await
9
10
  import expo.modules.kotlin.exception.Exceptions
@@ -80,6 +81,30 @@ class FileSystemModule : Module() {
80
81
  return@Coroutine destination.toURI()
81
82
  }
82
83
 
84
+ lateinit var filePickerLauncher: AppContextActivityResultLauncher<FilePickerContractOptions, FilePickerContractResult>
85
+
86
+ RegisterActivityContracts {
87
+ filePickerLauncher = registerForActivityResult(
88
+ FilePickerContract(this@FileSystemModule)
89
+ )
90
+ }
91
+
92
+ AsyncFunction("pickDirectoryAsync") Coroutine { initialUri: Uri? ->
93
+ val result = filePickerLauncher.launch(FilePickerContractOptions(initialUri, null, PickerType.DIRECTORY))
94
+ when (result) {
95
+ is FilePickerContractResult.Success -> result.path as FileSystemDirectory
96
+ is FilePickerContractResult.Cancelled -> throw PickerCancelledException()
97
+ }
98
+ }
99
+
100
+ AsyncFunction("pickFileAsync") Coroutine { initialUri: Uri?, mimeType: String? ->
101
+ val result = filePickerLauncher.launch(FilePickerContractOptions(initialUri, mimeType, PickerType.FILE))
102
+ when (result) {
103
+ is FilePickerContractResult.Success -> result.path as FileSystemFile
104
+ is FilePickerContractResult.Cancelled -> throw PickerCancelledException()
105
+ }
106
+ }
107
+
83
108
  Function("info") { url: URI ->
84
109
  val file = File(url)
85
110
  val permissions = appContext.filePermission?.getPathPermissions(appContext.reactContext, file.path)
@@ -7,45 +7,56 @@ import java.io.InputStream
7
7
  import java.io.OutputStream
8
8
 
9
9
  class SAFDocumentFile(private val context: Context, override val uri: Uri) : UnifiedFileInterface {
10
- private val treeDocumentFile: DocumentFile? = DocumentFile.fromTreeUri(context, uri)
10
+ private val documentFile: DocumentFile?
11
+ get() {
12
+ // Relying on singleUri.isDirectory did not work, and there's no explicit method for this, so we check path
13
+ val pathSegment = uri.pathSegments.getOrNull(0) ?: "tree"
14
+ if (pathSegment == "document") {
15
+ // If the path starts with "document", we treat it as a raw file URI
16
+ return DocumentFile.fromSingleUri(context, uri)
17
+ } else {
18
+ // Otherwise, we treat it as a tree URI
19
+ return DocumentFile.fromTreeUri(context, uri)
20
+ }
21
+ }
11
22
 
12
- override fun exists(): Boolean = treeDocumentFile?.exists() == true
23
+ override fun exists(): Boolean = documentFile?.exists() == true
13
24
 
14
25
  override fun isDirectory(): Boolean {
15
- return treeDocumentFile?.isDirectory == true
26
+ return documentFile?.isDirectory == true
16
27
  }
17
28
 
18
29
  override fun isFile(): Boolean {
19
- return treeDocumentFile?.isFile == true
30
+ return documentFile?.isFile == true
20
31
  }
21
32
 
22
33
  override val parentFile: UnifiedFileInterface?
23
- get() = treeDocumentFile?.parentFile?.uri?.let { SAFDocumentFile(context, it) }
34
+ get() = documentFile?.parentFile?.uri?.let { SAFDocumentFile(context, it) }
24
35
 
25
36
  override fun createFile(mimeType: String, displayName: String): UnifiedFileInterface? {
26
- val documentFile = treeDocumentFile?.createFile(mimeType, displayName)
37
+ val documentFile = documentFile?.createFile(mimeType, displayName)
27
38
  return documentFile?.uri?.let { SAFDocumentFile(context, it) }
28
39
  }
29
40
 
30
41
  override fun createDirectory(displayName: String): UnifiedFileInterface? {
31
- val documentFile = treeDocumentFile?.createDirectory(displayName)
42
+ val documentFile = documentFile?.createDirectory(displayName)
32
43
  return documentFile?.uri?.let { SAFDocumentFile(context, it) }
33
44
  }
34
45
 
35
- override fun delete(): Boolean = treeDocumentFile?.delete() == true
46
+ override fun delete(): Boolean = documentFile?.delete() == true
36
47
 
37
48
  override fun listFilesAsUnified(): List<UnifiedFileInterface> =
38
- treeDocumentFile?.listFiles()?.map { SAFDocumentFile(context, it.uri) } ?: emptyList()
49
+ documentFile?.listFiles()?.map { SAFDocumentFile(context, it.uri) } ?: emptyList()
39
50
 
40
51
  override val type: String?
41
- get() = treeDocumentFile?.type
52
+ get() = documentFile?.type
42
53
 
43
54
  override fun lastModified(): Long? {
44
- return treeDocumentFile?.lastModified()
55
+ return documentFile?.lastModified()
45
56
  }
46
57
 
47
58
  override val fileName: String?
48
- get() = treeDocumentFile?.name
59
+ get() = documentFile?.name
49
60
 
50
61
  override val creationTime: Long? get() {
51
62
  // It seems there's no way to get this
@@ -63,14 +74,14 @@ class SAFDocumentFile(private val context: Context, override val uri: Uri) : Uni
63
74
  }
64
75
 
65
76
  override fun length(): Long {
66
- return treeDocumentFile?.length() ?: 0
77
+ return documentFile?.length() ?: 0
67
78
  }
68
79
 
69
80
  override fun walkTopDown(): Sequence<SAFDocumentFile> {
70
81
  return sequence {
71
82
  yield(this@SAFDocumentFile)
72
83
  if (isDirectory()) {
73
- treeDocumentFile?.listFiles()?.forEach { child ->
84
+ documentFile?.listFiles()?.forEach { child ->
74
85
  yieldAll(SAFDocumentFile(context, child.uri).walkTopDown())
75
86
  }
76
87
  }
@@ -4,6 +4,8 @@ declare class ExpoFileSystemModule extends NativeModule {
4
4
  FileSystemDirectory: typeof Directory;
5
5
  FileSystemFile: typeof File;
6
6
  downloadFileAsync(url: string, destination: File | Directory, options?: DownloadOptions): Promise<string>;
7
+ pickDirectoryAsync(initialUri?: string): Promise<Directory>;
8
+ pickFileAsync(initialUri?: string, mimeType?: string): Promise<File>;
7
9
  totalDiskSpace: number;
8
10
  availableDiskSpace: number;
9
11
  documentDirectory: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFileSystem.d.ts","sourceRoot":"","sources":["../src/ExpoFileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,OAAO,oBAAqB,SAAQ,YAAY;IACrD,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;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;;AAED,wBAAuE"}
1
+ {"version":3,"file":"ExpoFileSystem.d.ts","sourceRoot":"","sources":["../src/ExpoFileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,OAAO,oBAAqB,SAAQ,YAAY;IACrD,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;IAClB,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAC3D,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACpE,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;;AAED,wBAAuE"}
@@ -69,15 +69,28 @@ export declare class Directory {
69
69
  */
70
70
  list(): (Directory | File)[];
71
71
  /**
72
- * Retrieves an object containing properties of a directory
72
+ * Retrieves an object containing properties of a directory.
73
+ *
73
74
  * @throws Error If the application does not have read access to the directory, or if the path does not point to a directory (e.g., it points to a file).
74
- * @returns An object with directory metadata (e.g., size, creation date, etc.).
75
+ *
76
+ * @returns An object with directory metadata (for example, size, creation date, and so on).
75
77
  */
76
78
  info(): DirectoryInfo;
77
79
  /**
78
80
  * A size of the directory in bytes. Null if the directory does not exist, or it cannot be read.
79
81
  */
80
82
  size: number | null;
83
+ /**
84
+ *
85
+ * A static method that opens a file picker to select a directory.
86
+ *
87
+ * @platform android
88
+ *
89
+ * @param initialUri An optional URI pointing to an initial folder on which the directory picker is opened.
90
+ *
91
+ * @returns A `Directory` instance. The underlying URI will be a content URI on Android.
92
+ */
93
+ static pickDirectoryAsync(initialUri?: string): Promise<Directory>;
81
94
  }
82
95
  export type DownloadOptions = {
83
96
  /**
@@ -115,7 +128,7 @@ export declare class File {
115
128
  * Retrieves text from the file.
116
129
  * @returns The contents of the file as string.
117
130
  */
118
- textSync(): Promise<string>;
131
+ textSync(): string;
119
132
  /**
120
133
  * Retrieves content of the file as base64.
121
134
  * @returns A promise that resolves with the contents of the file as a base64 string.
@@ -149,8 +162,8 @@ export declare class File {
149
162
  delete(): void;
150
163
  /**
151
164
  * Retrieves an object containing properties of a file
152
- * @throws Error If the application does not have read access to the file, or if the path does not point to a file (e.g., it points to a directory).
153
- * @returns An object with file metadata (e.g., size, creation date, etc.).
165
+ * @throws Error If the application does not have read access to the file, or if the path does not point to a file (for example, it points to a directory).
166
+ * @returns An object with file metadata (for example, size, creation date, and so on).
154
167
  */
155
168
  info(options?: InfoOptions): FileInfo;
156
169
  /**
@@ -173,21 +186,35 @@ export declare class File {
173
186
  */
174
187
  move(destination: Directory | File): void;
175
188
  /**
176
- * Returns a FileHandle object that can be used to read and write data to the file.
189
+ * Returns A `FileHandle` object that can be used to read and write data to the file.
177
190
  * @throws Error if the file does not exist or cannot be opened.
178
191
  */
179
192
  open(): FileHandle;
180
193
  /**
181
194
  * A static method that downloads a file from the network.
195
+ *
182
196
  * @param url - The URL of the file to download.
183
197
  * @param destination - The destination directory or file. If a directory is provided, the resulting filename will be determined based on the response headers.
198
+ *
184
199
  * @returns A promise that resolves to the downloaded file.
200
+ *
185
201
  * @example
186
202
  * ```ts
187
203
  * const file = await File.downloadFileAsync("https://example.com/image.png", new Directory(Paths.document));
188
204
  * ```
189
205
  */
190
206
  static downloadFileAsync(url: string, destination: Directory | File, options?: DownloadOptions): Promise<File>;
207
+ /**
208
+ * A static method that opens a file picker to select a single file of specified type.
209
+ *
210
+ * @platform android
211
+ *
212
+ * @param initialUri An optional URI pointing to an initial folder on which the file picker is opened.
213
+ * @param mimeType A mime type that is used to filter out files that can be picked out.
214
+ *
215
+ * @returns A `File` instance.
216
+ */
217
+ static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File>;
191
218
  /**
192
219
  * A size of the file in bytes. 0 if the file does not exist, or it cannot be read.
193
220
  */
@@ -245,6 +272,7 @@ export type FileInfo = {
245
272
  export type InfoOptions = {
246
273
  /**
247
274
  * Whether to return the MD5 hash of the file.
275
+ *
248
276
  * @default false
249
277
  */
250
278
  md5?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFileSystem.types.d.ts","sourceRoot":"","sources":["../src/ExpoFileSystem.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;;;OAOG;gBACS,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE;IAElD;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,IAAI,IAAI;IAEpB;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAEd;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;IAErC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAEvD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;IAExC;;OAEG;IACH,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI;IAEzC;;OAEG;IACH,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI,G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AAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE;IAQlD,IAAI,eAAe,cAElB;IAED;;;;OAIG;IACM,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE;IAOrC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAKvD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;CAGzC"}
@@ -12,7 +12,7 @@
12
12
  "publication": {
13
13
  "groupId": "host.exp.exponent",
14
14
  "artifactId": "expo.modules.filesystem",
15
- "version": "19.0.2",
15
+ "version": "19.0.4",
16
16
  "repository": "local-maven-repo"
17
17
  }
18
18
  }
@@ -0,0 +1 @@
1
+ 9cf826cfa827700e415e780bc1b4a49477ea31486d465154824b7331c89e9dc7
@@ -0,0 +1 @@
1
+ c91977ae610fa808ea0765cd14182ad1d8961f59cbdf2df2396e7f77fe8cadbcd152018902a4f09474177b5ea77f78c107d6016c127d0546c4e9b0ebbf2b13fe
@@ -0,0 +1 @@
1
+ 977ef17ccaa7a6f8c09c70d2f2f2f0c1002f07df8b3756ce3905a37a7288b41b
@@ -0,0 +1 @@
1
+ 36dc7ab692103570111d72588e7674ae1c7cf2c0665a351738f87dc0af98dbccb34aef221f34b5630403f2d6fd46a13cd22e4b3fb75a90f6b8b0bc2a41dd49cf
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.filesystem",
6
- "version": "19.0.2",
6
+ "version": "19.0.4",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -75,13 +75,13 @@
75
75
  ],
76
76
  "files": [
77
77
  {
78
- "name": "expo.modules.filesystem-19.0.2.aar",
79
- "url": "expo.modules.filesystem-19.0.2.aar",
80
- "size": 355555,
81
- "sha512": "1a4366a3ef568e2a424c56459c7392817676d7558855346ba5a637e408ff3077960d9bd06ce042a1567eb051f52ee62282b4b0312b090066deda759f9f5a7f51",
82
- "sha256": "464908df1a8f9435fa74a6f4313f4c2180019dc04d6e466566f3486388864020",
83
- "sha1": "aa67c1e859974640d0fc6e9badd60aa2d12c5ed0",
84
- "md5": "8cdbf9c8f6d8d1e55b0bda1e0f4a382e"
78
+ "name": "expo.modules.filesystem-19.0.4.aar",
79
+ "url": "expo.modules.filesystem-19.0.4.aar",
80
+ "size": 373316,
81
+ "sha512": "36dc7ab692103570111d72588e7674ae1c7cf2c0665a351738f87dc0af98dbccb34aef221f34b5630403f2d6fd46a13cd22e4b3fb75a90f6b8b0bc2a41dd49cf",
82
+ "sha256": "977ef17ccaa7a6f8c09c70d2f2f2f0c1002f07df8b3756ce3905a37a7288b41b",
83
+ "sha1": "7f26aacfe041259700988a8f2e865b6d78a47865",
84
+ "md5": "67fb8fe6d438a03c9f9b1419f17a116d"
85
85
  }
86
86
  ]
87
87
  },
@@ -153,13 +153,13 @@
153
153
  ],
154
154
  "files": [
155
155
  {
156
- "name": "expo.modules.filesystem-19.0.2.aar",
157
- "url": "expo.modules.filesystem-19.0.2.aar",
158
- "size": 355555,
159
- "sha512": "1a4366a3ef568e2a424c56459c7392817676d7558855346ba5a637e408ff3077960d9bd06ce042a1567eb051f52ee62282b4b0312b090066deda759f9f5a7f51",
160
- "sha256": "464908df1a8f9435fa74a6f4313f4c2180019dc04d6e466566f3486388864020",
161
- "sha1": "aa67c1e859974640d0fc6e9badd60aa2d12c5ed0",
162
- "md5": "8cdbf9c8f6d8d1e55b0bda1e0f4a382e"
156
+ "name": "expo.modules.filesystem-19.0.4.aar",
157
+ "url": "expo.modules.filesystem-19.0.4.aar",
158
+ "size": 373316,
159
+ "sha512": "36dc7ab692103570111d72588e7674ae1c7cf2c0665a351738f87dc0af98dbccb34aef221f34b5630403f2d6fd46a13cd22e4b3fb75a90f6b8b0bc2a41dd49cf",
160
+ "sha256": "977ef17ccaa7a6f8c09c70d2f2f2f0c1002f07df8b3756ce3905a37a7288b41b",
161
+ "sha1": "7f26aacfe041259700988a8f2e865b6d78a47865",
162
+ "md5": "67fb8fe6d438a03c9f9b1419f17a116d"
163
163
  }
164
164
  ]
165
165
  },
@@ -173,13 +173,13 @@
173
173
  },
174
174
  "files": [
175
175
  {
176
- "name": "expo.modules.filesystem-19.0.2-sources.jar",
177
- "url": "expo.modules.filesystem-19.0.2-sources.jar",
178
- "size": 26822,
179
- "sha512": "ea65beba4d54d38bff01098d340a18c32c0d2ef808462b4557b54938b8407b79c775fe2e915434a99196389b407b755b8149e9b87ff6f3d0babd687f8754e53c",
180
- "sha256": "8097cd642d39939ebf8ec65d03aa1845ada4f549eca7e452afab9402799515c9",
181
- "sha1": "0042fe2aed8a969c26f2d2bb72a92b6ccd84f167",
182
- "md5": "99439b02aef17bd440c0abcaf089b748"
176
+ "name": "expo.modules.filesystem-19.0.4-sources.jar",
177
+ "url": "expo.modules.filesystem-19.0.4-sources.jar",
178
+ "size": 28421,
179
+ "sha512": "c91977ae610fa808ea0765cd14182ad1d8961f59cbdf2df2396e7f77fe8cadbcd152018902a4f09474177b5ea77f78c107d6016c127d0546c4e9b0ebbf2b13fe",
180
+ "sha256": "9cf826cfa827700e415e780bc1b4a49477ea31486d465154824b7331c89e9dc7",
181
+ "sha1": "5f879a11258f3b3e06b575f71e801aab8e25113b",
182
+ "md5": "8e4953080a31fa4851c0d3af21f5f2a8"
183
183
  }
184
184
  ]
185
185
  }
@@ -0,0 +1 @@
1
+ 8d14b91bf91010176f93304ee132f413213fc8eba873cdaa8c225f8ae6b751a7
@@ -0,0 +1 @@
1
+ d14c2b6ff242dec3839e5524b1265c382514fd6abf43c8c18d52bea0bf4c161c7a7ef71cd4a4df5fe306b83f473aaf69ddfe0a18b655004727d7a36360385746
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.filesystem</artifactId>
12
- <version>19.0.2</version>
12
+ <version>19.0.4</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.filesystem</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 515f67b27724a19f4a5a1e1a63e86bc64952c878e92f48da64add7ad2a8f9d1b
@@ -0,0 +1 @@
1
+ 7b59851c1649da0b73ac95cb71f1029147391dcb237ebec967b6c741f2e32d5b745a100af94084f02adbe22f929fa06b28db22e3c59dd1c5c0b4e87ccb3685b9
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.filesystem</artifactId>
5
5
  <versioning>
6
- <latest>19.0.2</latest>
7
- <release>19.0.2</release>
6
+ <latest>19.0.4</latest>
7
+ <release>19.0.4</release>
8
8
  <versions>
9
- <version>19.0.2</version>
9
+ <version>19.0.4</version>
10
10
  </versions>
11
- <lastUpdated>20250817001229</lastUpdated>
11
+ <lastUpdated>20250821040950</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 180d1ab04f46fcb453432817bccd2e76
1
+ 2d4234bd82278fa383aa7b86c4889564
@@ -1 +1 @@
1
- 1a184c08d3955ed560a0a824481090f2603688af
1
+ 412c3275b163960bb95d50e5774871cad923000a
@@ -1 +1 @@
1
- 96a8f9d311755b7a690e3a2ef03c804380b0ccfeabff9680a06c1ddf5e1c073e
1
+ 8e923335464a3b7e7f0d582ed90f59292713b9c6c8c1d871bde0084397eb3d84
@@ -1 +1 @@
1
- a9f085f6cbc6dd881bd1a6520d3b38cd000042c0b539879d99ee10af8bd3062827f6f29597303118996024cdf18d020687ceaee89bc78fbf5bd01b682bd69bfc
1
+ 697118aab70c0975e4e8736ba5b168fa47fde7764f7b7205eb23e0b073a8ab777cbc7d12c3cdde69d35b681a1467752b9e927c8ce400693c18de48c78d7f8b6d
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-file-system",
3
- "version": "19.0.2",
3
+ "version": "19.0.4",
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",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "expo-module-scripts": "^5.0.2",
39
- "jest-expo": "~54.0.1"
39
+ "jest-expo": "~54.0.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "expo": "*",
43
43
  "react-native": "*"
44
44
  },
45
- "gitHead": "eaa9b645058cf2233fbb27bb21a19bc605c90a88"
45
+ "gitHead": "3275774c9286477adba9bc226d3923a996217ee4"
46
46
  }
@@ -10,6 +10,8 @@ declare class ExpoFileSystemModule extends NativeModule {
10
10
  destination: File | Directory,
11
11
  options?: DownloadOptions
12
12
  ): Promise<string>;
13
+ pickDirectoryAsync(initialUri?: string): Promise<Directory>;
14
+ pickFileAsync(initialUri?: string, mimeType?: string): Promise<File>;
13
15
  totalDiskSpace: number;
14
16
  availableDiskSpace: number;
15
17
  documentDirectory: string;
@@ -79,9 +79,11 @@ export declare class Directory {
79
79
  list(): (Directory | File)[];
80
80
 
81
81
  /**
82
- * Retrieves an object containing properties of a directory
82
+ * Retrieves an object containing properties of a directory.
83
+ *
83
84
  * @throws Error If the application does not have read access to the directory, or if the path does not point to a directory (e.g., it points to a file).
84
- * @returns An object with directory metadata (e.g., size, creation date, etc.).
85
+ *
86
+ * @returns An object with directory metadata (for example, size, creation date, and so on).
85
87
  */
86
88
  info(): DirectoryInfo;
87
89
 
@@ -89,6 +91,18 @@ export declare class Directory {
89
91
  * A size of the directory in bytes. Null if the directory does not exist, or it cannot be read.
90
92
  */
91
93
  size: number | null;
94
+
95
+ /**
96
+ *
97
+ * A static method that opens a file picker to select a directory.
98
+ *
99
+ * @platform android
100
+ *
101
+ * @param initialUri An optional URI pointing to an initial folder on which the directory picker is opened.
102
+ *
103
+ * @returns A `Directory` instance. The underlying URI will be a content URI on Android.
104
+ */
105
+ static pickDirectoryAsync(initialUri?: string): Promise<Directory>;
92
106
  }
93
107
 
94
108
  export type DownloadOptions = {
@@ -132,7 +146,7 @@ export declare class File {
132
146
  * Retrieves text from the file.
133
147
  * @returns The contents of the file as string.
134
148
  */
135
- textSync(): Promise<string>;
149
+ textSync(): string;
136
150
 
137
151
  /**
138
152
  * Retrieves content of the file as base64.
@@ -173,8 +187,8 @@ export declare class File {
173
187
 
174
188
  /**
175
189
  * Retrieves an object containing properties of a file
176
- * @throws Error If the application does not have read access to the file, or if the path does not point to a file (e.g., it points to a directory).
177
- * @returns An object with file metadata (e.g., size, creation date, etc.).
190
+ * @throws Error If the application does not have read access to the file, or if the path does not point to a file (for example, it points to a directory).
191
+ * @returns An object with file metadata (for example, size, creation date, and so on).
178
192
  */
179
193
  info(options?: InfoOptions): FileInfo;
180
194
 
@@ -202,16 +216,19 @@ export declare class File {
202
216
  move(destination: Directory | File): void;
203
217
 
204
218
  /**
205
- * Returns a FileHandle object that can be used to read and write data to the file.
219
+ * Returns A `FileHandle` object that can be used to read and write data to the file.
206
220
  * @throws Error if the file does not exist or cannot be opened.
207
221
  */
208
222
  open(): FileHandle;
209
223
 
210
224
  /**
211
225
  * A static method that downloads a file from the network.
226
+ *
212
227
  * @param url - The URL of the file to download.
213
228
  * @param destination - The destination directory or file. If a directory is provided, the resulting filename will be determined based on the response headers.
229
+ *
214
230
  * @returns A promise that resolves to the downloaded file.
231
+ *
215
232
  * @example
216
233
  * ```ts
217
234
  * const file = await File.downloadFileAsync("https://example.com/image.png", new Directory(Paths.document));
@@ -223,6 +240,18 @@ export declare class File {
223
240
  options?: DownloadOptions
224
241
  ): Promise<File>;
225
242
 
243
+ /**
244
+ * A static method that opens a file picker to select a single file of specified type.
245
+ *
246
+ * @platform android
247
+ *
248
+ * @param initialUri An optional URI pointing to an initial folder on which the file picker is opened.
249
+ * @param mimeType A mime type that is used to filter out files that can be picked out.
250
+ *
251
+ * @returns A `File` instance.
252
+ */
253
+ static pickFileAsync(initialUri?: string, mimeType?: string): Promise<File>;
254
+
226
255
  /**
227
256
  * A size of the file in bytes. 0 if the file does not exist, or it cannot be read.
228
257
  */
@@ -306,6 +335,7 @@ export type FileInfo = {
306
335
  export type InfoOptions = {
307
336
  /**
308
337
  * Whether to return the MD5 hash of the file.
338
+ *
309
339
  * @default false
310
340
  */
311
341
  md5?: boolean;
package/src/FileSystem.ts CHANGED
@@ -125,6 +125,11 @@ File.downloadFileAsync = async function downloadFileAsync(
125
125
  return new File(outputURI);
126
126
  };
127
127
 
128
+ File.pickFileAsync = async function (initialUri?: string, mimeType?: string) {
129
+ const file = (await ExpoFileSystem.pickFileAsync(initialUri, mimeType)).uri;
130
+ return new File(file);
131
+ };
132
+
128
133
  /**
129
134
  * Represents a directory on the filesystem.
130
135
  *
@@ -179,3 +184,8 @@ export class Directory extends ExpoFileSystem.FileSystemDirectory {
179
184
  return new Directory(super.createDirectory(name).uri);
180
185
  }
181
186
  }
187
+
188
+ Directory.pickDirectoryAsync = async function (initialUri?: string) {
189
+ const directory = (await ExpoFileSystem.pickDirectoryAsync(initialUri)).uri;
190
+ return new Directory(directory);
191
+ };
@@ -1 +0,0 @@
1
- 8097cd642d39939ebf8ec65d03aa1845ada4f549eca7e452afab9402799515c9
@@ -1 +0,0 @@
1
- ea65beba4d54d38bff01098d340a18c32c0d2ef808462b4557b54938b8407b79c775fe2e915434a99196389b407b755b8149e9b87ff6f3d0babd687f8754e53c
@@ -1 +0,0 @@
1
- 464908df1a8f9435fa74a6f4313f4c2180019dc04d6e466566f3486388864020
@@ -1 +0,0 @@
1
- 1a4366a3ef568e2a424c56459c7392817676d7558855346ba5a637e408ff3077960d9bd06ce042a1567eb051f52ee62282b4b0312b090066deda759f9f5a7f51
@@ -1 +0,0 @@
1
- 468df42d436ec31621400a7206d5be3966b23f93a06af293d0ba98a96e0f52bc
@@ -1 +0,0 @@
1
- 944b83f7052e68ef56f7219b2ce9ff668af44983fff1fb6ee573a54f7a9cad4ffde2661d36f81b80be90ce628e2ca10c611894d081c0c4acd9351208320d8cc4
@@ -1 +0,0 @@
1
- 1cab7e2943ced4469577ea0490b10785390859ddf2dd4e0c50f42d79db2a7b61
@@ -1 +0,0 @@
1
- 2f59205a0923a4e9dd3394ed36e1d1d55ec85c97ff1ce3c8ff2de66cf14e7dae038a675f5e54ad5ebc64e832d4d7e8a0b6a111d75e67d06092cdf375a6ccadd7