expo-file-system 15.2.2 β†’ 15.3.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 CHANGED
@@ -10,6 +10,20 @@
10
10
 
11
11
  ### πŸ’‘ Others
12
12
 
13
+ ## 15.3.0 β€” 2023-05-08
14
+
15
+ ### πŸ›  Breaking changes
16
+
17
+ - Removed the deprecated `UploadProgressData.totalByteSent` field. ([#22277](https://github.com/expo/expo/pull/22277) by [@gabrieldonadel](https://github.com/gabrieldonadel))
18
+
19
+ ### πŸ› Bug fixes
20
+
21
+ - Add UTF-8 URI support on iOS. ([#21196](https://github.com/expo/expo/pull/21196) by [@gabrieldonadel](https://github.com/gabrieldonadel))
22
+
23
+ ### πŸ’‘ Others
24
+
25
+ - Android: Switch from deprecated `toLowerCase` to `lowercase` function ([#22225](https://github.com/expo/expo/pull/22225) by [@hbiede](https://github.com/hbiede))
26
+
13
27
  ## 15.2.2 β€” 2023-02-09
14
28
 
15
29
  _This version does not introduce any user-facing changes._
package/README.md CHANGED
@@ -16,7 +16,7 @@ Provides access to the local file system on the device.
16
16
 
17
17
  # Installation in managed Expo projects
18
18
 
19
- For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/filesystem/).
19
+ For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/filesystem/).
20
20
 
21
21
  # Installation in bare React Native projects
22
22
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '15.2.2'
6
+ version = '15.3.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
76
  versionCode 30
77
- versionName "15.2.2"
77
+ versionName "15.3.0"
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -1245,7 +1245,7 @@ open class FileSystemModule(
1245
1245
 
1246
1246
  private fun getEncodingFromOptions(options: Map<String?, Any?>): String {
1247
1247
  return if (options.containsKey("encoding") && options["encoding"] is String) {
1248
- (options["encoding"] as String).toLowerCase(Locale.ROOT)
1248
+ (options["encoding"] as String).lowercase(Locale.ROOT)
1249
1249
  } else {
1250
1250
  "utf8"
1251
1251
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../src/FileSystem.ts"],"names":[],"mappings":"AAKA,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;AAGtF,eAAO,MAAQ,aAAa,iBAAE,eAAe,eAAuB,CAAC;AAErE;;;;;;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,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CAA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SAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,UAE1D;IAED;;;;;;OAMG;IACH,SAAsB,gCAAgC,CACpD,cAAc,GAAE,MAAM,GAAG,IAAW,GACnC,OAAO,CAAC,2CAA2C,CAAC,CAStD;IAED;;;;OAIG;IACH,SAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQ1E;IAED;;;;;OAKG;IACH,SAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ5F;IAED;;;;;;OAMG;IACH,SAAsB,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"}
@@ -268,9 +268,6 @@ export function createDownloadResumable(uri, fileUri, options, callback, resumeD
268
268
  export function createUploadTask(url, fileUri, options, callback) {
269
269
  return new UploadTask(url, fileUri, options, callback);
270
270
  }
271
- function isUploadProgressData(data) {
272
- return 'totalBytesSent' in data;
273
- }
274
271
  export class FileSystemCancellableNetworkTask {
275
272
  _uuid = uuidv4();
276
273
  taskWasCanceled = false;
@@ -303,16 +300,6 @@ export class FileSystemCancellableNetworkTask {
303
300
  if (event.uuid === this.uuid) {
304
301
  const callback = this.getCallback();
305
302
  if (callback) {
306
- if (isUploadProgressData(event.data)) {
307
- const data = {
308
- ...event.data,
309
- get totalByteSent() {
310
- console.warn('Key "totalByteSent" in File System UploadProgressData is deprecated and will be removed in SDK 49, use "totalBytesSent" instead');
311
- return this.totalBytesSent;
312
- },
313
- };
314
- return callback(data);
315
- }
316
303
  callback(event.data);
317
304
  }
318
305
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../src/FileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,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,eAAe;AACf,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAe,EAAE,UAAuB,EAAE;IAC3E,IAAI,CAAC,kBAAk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AiB,EACjB,QAAgB,EAChB,QAAgB;QAEhB,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,EAAE;YAC1C,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,wCAAwC,CAAC,CAAC;SAC7F;QACD,OAAO,MAAM,kBAAkB,CAAC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpF,CAAC;IATqB,sCAAe,kBASpC,CAAA;IAED;;OAEG;IACU,yCAAkB,GAAG,sBAAsB,CAAC;IACzD;;OAEG;IACU,wCAAiB,GAAG,qBAAqB,CAAC;IACvD;;OAEG;IACU,kCAAW,GAAG,eAAe,CAAC;IAC3C;;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 } from 'expo-modules-core';\nimport { Platform } from 'react-native';\nimport { v4 as uuidv4 } from 'uuid';\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// @docsMissing\nexport const { bundledAssets, bundleDirectory } = ExponentFileSystem;\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 [`GetInfoAsyncOptions`](#getinfoasyncoptions) 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\nfunction isUploadProgressData(\n data: DownloadProgressData | UploadProgressData\n): data is UploadProgressData {\n return 'totalBytesSent' in data;\n}\n\nexport abstract class FileSystemCancellableNetworkTask<\n T extends DownloadProgressData | UploadProgressData\n> {\n private _uuid = uuidv4();\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 if (isUploadProgressData(event.data)) {\n const data = {\n ...event.data,\n get totalByteSent() {\n console.warn(\n 'Key \"totalByteSent\" in File System UploadProgressData is deprecated and will be removed in SDK 49, use \"totalBytesSent\" instead'\n );\n return this.totalBytesSent;\n },\n };\n return callback(data);\n }\n\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 fro [`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,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,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,eAAe;AACf,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,CAAC,KAA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B,GAAG,sBAAsB,CAAC;IACzD;;OAEG;IACU,wCAAiB,GAAG,qBAAqB,CAAC;IACvD;;OAEG;IACU,kCAAW,GAAG,eAAe,CAAC;IAC3C;;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 } from 'expo-modules-core';\nimport { Platform } from 'react-native';\nimport { v4 as uuidv4 } from 'uuid';\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// @docsMissing\nexport const { bundledAssets, bundleDirectory } = ExponentFileSystem;\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 [`GetInfoAsyncOptions`](#getinfoasyncoptions) 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 = uuidv4();\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 fro [`copyAsync`](#filesystemcopyasyncoptions) method.\n */\n export const copyAsync = baseCopyAsync;\n}\n"]}
@@ -147,10 +147,6 @@ export type UploadProgressData = {
147
147
  * The total bytes sent by the upload operation.
148
148
  */
149
149
  totalBytesSent: number;
150
- /**
151
- * @deprecated Use `totalBytesSent` instead.
152
- */
153
- totalByteSent: number;
154
150
  /**
155
151
  * The total bytes expected to be sent by the upload operation.
156
152
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.types.d.ts","sourceRoot":"","sources":["../src/FileSystem.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B;;;;OAIG;IACH,UAAU,IAAI;IACd;;;OAGG;IACH,UAAU,IAA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AAE,OAAO,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAGF,MAAM,MAAM,2CAA2C;AACrD;;GAEG;AACH;IACE,OAAO,EAAE,KAAK,CAAC;CAChB;AACD;;GAEG;AACH;IACE,OAAO,EAAE,IAAI,CAAC;IACd;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.types.js","sourceRoot":"","sources":["../src/FileSystem.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAN,IAAY,qBAYX;AAZD,WAAY,qBAAqB;IAC/B;;;;OAIG;IACH,6EAAc,CAAA;IACd;;;OAGG;IACH,6EAAc,CAAA;AAChB,CAAC,EAZW,qBAAqB,KAArB,qBAAqB,QAYhC;AAED,MAAM,CAAN,IAAY,oBAUX;AAVD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,mFAAkB,CAAA;IAClB;;;OAGG;IACH,yEAAa,CAAA;AACf,CAAC,EAVW,oBAAoB,KAApB,oBAAoB,QAU/B;AA+MD,mBAAmB;AAEnB;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB;;OAEG;IACH,6BAAa,CAAA;IACb;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AA6FD,mBAAmB","sourcesContent":["/**\n * These values can be used to define how sessions work on iOS.\n * @platform ios\n */\nexport enum FileSystemSessionType {\n /**\n * Using this mode means that the downloading/uploading session on the native side will work even if the application is moved to background.\n * If the task completes while the application is in background, the Promise will be either resolved immediately or (if the application execution has already been stopped) once the app is moved to foreground again.\n * > Note: The background session doesn't fail if the server or your connection is down. Rather, it continues retrying until the task succeeds or is canceled manually.\n */\n BACKGROUND = 0,\n /**\n * Using this mode means that downloading/uploading session on the native side will be terminated once the application becomes inactive (e.g. when it goes to background).\n * Bringing the application to foreground again would trigger Promise rejection.\n */\n FOREGROUND = 1,\n}\n\nexport enum FileSystemUploadType {\n /**\n * The file will be sent as a request's body. The request can't contain additional data.\n */\n BINARY_CONTENT = 0,\n /**\n * An [RFC 2387-compliant](https://www.ietf.org/rfc/rfc2387.txt) request body. The provided file will be encoded into HTTP request.\n * This request can contain additional data represented by [`UploadOptionsMultipart`](#uploadoptionsmultipart) type.\n */\n MULTIPART = 1,\n}\n\nexport type DownloadOptions = {\n /**\n * If `true`, include the MD5 hash of the file in the returned object. Provided for convenience since it is common to check the integrity of a file immediately after downloading.\n * @default false\n */\n md5?: boolean;\n // @docsMissing\n cache?: boolean;\n /**\n * An object containing all the HTTP header fields and their values for the download network request. The keys and values of the object are the header names and values respectively.\n */\n headers?: Record<string, string>;\n /**\n * A session type. Determines if tasks can be handled in the background. On Android, sessions always work in the background and you can't change it.\n * @default FileSystemSessionType.BACKGROUND\n * @platform ios\n */\n sessionType?: FileSystemSessionType;\n};\n\nexport type FileSystemHttpResult = {\n /**\n * An object containing all the HTTP response header fields and their values for the download network request.\n * The keys and values of the object are the header names and values respectively.\n */\n headers: Record<string, string>;\n /**\n * The HTTP response status code for the download network request.\n */\n status: number;\n // @docsMissing\n mimeType: string | null;\n};\n\nexport type FileSystemDownloadResult = FileSystemHttpResult & {\n /**\n * A `file://` URI pointing to the file. This is the same as the `fileUri` input parameter.\n */\n uri: string;\n /**\n * Present if the `md5` option was truthy. Contains the MD5 hash of the file.\n */\n md5?: string;\n};\n\n/**\n * @deprecated Use `FileSystemDownloadResult` instead.\n */\nexport type DownloadResult = FileSystemDownloadResult;\n\nexport type FileSystemUploadOptions = (UploadOptionsBinary | UploadOptionsMultipart) & {\n /**\n * An object containing all the HTTP header fields and their values for the upload network request.\n * The keys and values of the object are the header names and values respectively.\n */\n headers?: Record<string, string>;\n /**\n * The request method.\n * @default FileSystemAcceptedUploadHttpMethod.POST\n */\n httpMethod?: FileSystemAcceptedUploadHttpMethod;\n /**\n * A session type. Determines if tasks can be handled in the background. On Android, sessions always work in the background and you can't change it.\n * @default FileSystemSessionType.BACKGROUND\n * @platform ios\n */\n sessionType?: FileSystemSessionType;\n};\n\n/**\n * Upload options when upload type is set to binary.\n */\nexport type UploadOptionsBinary = {\n /**\n * Upload type determines how the file will be sent to the server.\n * Value will be `FileSystemUploadType.BINARY_CONTENT`.\n */\n uploadType?: FileSystemUploadType;\n};\n\n/**\n * Upload options when upload type is set to multipart.\n */\nexport type UploadOptionsMultipart = {\n /**\n * Upload type determines how the file will be sent to the server.\n * Value will be `FileSystemUploadType.MULTIPART`.\n */\n uploadType: FileSystemUploadType;\n /**\n * The name of the field which will hold uploaded file. Defaults to the file name without an extension.\n */\n fieldName?: string;\n /**\n * The MIME type of the provided file. If not provided, the module will try to guess it based on the extension.\n */\n mimeType?: string;\n /**\n * Additional form properties. They will be located in the request body.\n */\n parameters?: Record<string, string>;\n};\n\nexport type FileSystemUploadResult = FileSystemHttpResult & {\n /**\n * The body of the server response.\n */\n body: string;\n};\n\n// @docsMissing\nexport type FileSystemNetworkTaskProgressCallback<\n T extends DownloadProgressData | UploadProgressData\n> = (data: T) => void;\n\n/**\n * @deprecated use `FileSystemNetworkTaskProgressCallback<DownloadProgressData>` instead.\n */\nexport type DownloadProgressCallback = FileSystemNetworkTaskProgressCallback<DownloadProgressData>;\n\nexport type DownloadProgressData = {\n /**\n * The total bytes written by the download operation.\n */\n totalBytesWritten: number;\n /**\n * The total bytes expected to be written by the download operation. A value of `-1` means that the server did not return the `Content-Length` header\n * and the total size is unknown. Without this header, you won't be able to track the download progress.\n */\n totalBytesExpectedToWrite: number;\n};\n\nexport type UploadProgressData = {\n /**\n * The total bytes sent by the upload operation.\n */\n totalBytesSent: number;\n /**\n * @deprecated Use `totalBytesSent` instead.\n */\n totalByteSent: number;\n /**\n * The total bytes expected to be sent by the upload operation.\n */\n totalBytesExpectedToSend: number;\n};\n\nexport type DownloadPauseState = {\n /**\n * The remote URI to download from.\n */\n url: string;\n /**\n * The local URI of the file to download to. If there is no file at this URI, a new one is created. If there is a file at this URI, its contents are replaced.\n */\n fileUri: string;\n /**\n * Object representing the file download options.\n */\n options: DownloadOptions;\n /**\n * The string which allows the API to resume a paused download.\n */\n resumeData?: string;\n};\n\n/* eslint-disable */\nexport type FileInfo =\n /**\n * Object returned when file exist.\n */\n {\n /**\n * Signifies that the requested file exist.\n */\n exists: true;\n /**\n * A `file://` URI pointing to the file. This is the same as the `fileUri` input parameter.\n */\n uri: string;\n /**\n * The size of the file in bytes. If operating on a source such as an iCloud file, only present if the `size` option was truthy.\n */\n size: number;\n /**\n * Boolean set to `true` if this is a directory and `false` if it is a file.\n */\n isDirectory: boolean;\n /**\n * The last modification time of the file expressed in seconds since epoch.\n */\n modificationTime: number;\n /**\n * Present if the `md5` option was truthy. Contains the MD5 hash of the file.\n */\n md5?: string;\n } |\n /**\n * Object returned when file do not exist.\n */\n {\n exists: false;\n uri: string;\n isDirectory: false;\n };\n/* eslint-enable */\n\n/**\n * These values can be used to define how file system data is read / written.\n */\nexport enum EncodingType {\n /**\n * Standard encoding format.\n */\n UTF8 = 'utf8',\n /**\n * Binary, radix-64 representation.\n */\n Base64 = 'base64',\n}\n\n// @docsMissing\nexport type FileSystemAcceptedUploadHttpMethod = 'POST' | 'PUT' | 'PATCH';\n\nexport type ReadingOptions = {\n /**\n * The encoding format to use when reading the file.\n * @default EncodingType.UTF8\n */\n encoding?: EncodingType | 'utf8' | 'base64';\n /**\n * Optional number of bytes to skip. This option is only used when `encoding: FileSystem.EncodingType.Base64` and `length` is defined.\n * */\n position?: number;\n /**\n * Optional number of bytes to read. This option is only used when `encoding: FileSystem.EncodingType.Base64` and `position` is defined.\n */\n length?: number;\n};\n\nexport type WritingOptions = {\n /**\n * The encoding format to use when writing the file.\n * @default FileSystem.EncodingType.UTF8\n */\n encoding?: EncodingType | 'utf8' | 'base64';\n};\n\nexport type DeletingOptions = {\n /**\n * If `true`, don't throw an error if there is no file or directory at this URI.\n * @default false\n */\n idempotent?: boolean;\n};\n\nexport type InfoOptions = {\n /**\n * Whether to return the MD5 hash of the file.\n * @default false\n */\n md5?: boolean;\n /**\n * Explicitly specify that the file size should be included. For example, skipping this can prevent downloading the file if it's stored in iCloud.\n * The size is always returned for `file://` locations.\n */\n size?: boolean;\n};\n\nexport type RelocatingOptions = {\n /**\n * URI or [SAF](#saf-uri) URI to the asset, file, or directory. See [supported URI schemes](#supported-uri-schemes-1).\n */\n from: string;\n /**\n * `file://` URI to the file or directory which should be its new location.\n */\n to: string;\n};\n\nexport type MakeDirectoryOptions = {\n /**\n * If `true`, don't throw an error if there is no file or directory at this URI.\n * @default false\n */\n intermediates?: boolean;\n};\n\n// @docsMissing\nexport type ProgressEvent<T> = {\n uuid: string;\n data: T;\n};\n\n/* eslint-disable */\nexport type FileSystemRequestDirectoryPermissionsResult =\n /**\n * If the permissions were not granted.\n */\n {\n granted: false;\n } |\n /**\n * If the permissions were granted.\n */\n {\n granted: true;\n /**\n * The [SAF URI](#saf-uri) to the user's selected directory. Available only if permissions were granted.\n */\n directoryUri: string;\n };\n/* eslint-enable */\n"]}
1
+ {"version":3,"file":"FileSystem.types.js","sourceRoot":"","sources":["../src/FileSystem.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAN,IAAY,qBAYX;AAZD,WAAY,qBAAqB;IAC/B;;;;OAIG;IACH,6EAAc,CAAA;IACd;;;OAGG;IACH,6EAAc,CAAA;AAChB,CAAC,EAZW,qBAAqB,KAArB,qBAAqB,QAYhC;AAED,MAAM,CAAN,IAAY,oBAUX;AAVD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,mFAAkB,CAAA;IAClB;;;OAGG;IACH,yEAAa,CAAA;AACf,CAAC,EAVW,oBAAoB,KAApB,oBAAoB,QAU/B;AA2MD,mBAAmB;AAEnB;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB;;OAEG;IACH,6BAAa,CAAA;IACb;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AA6FD,mBAAmB","sourcesContent":["/**\n * These values can be used to define how sessions work on iOS.\n * @platform ios\n */\nexport enum FileSystemSessionType {\n /**\n * Using this mode means that the downloading/uploading session on the native side will work even if the application is moved to background.\n * If the task completes while the application is in background, the Promise will be either resolved immediately or (if the application execution has already been stopped) once the app is moved to foreground again.\n * > Note: The background session doesn't fail if the server or your connection is down. Rather, it continues retrying until the task succeeds or is canceled manually.\n */\n BACKGROUND = 0,\n /**\n * Using this mode means that downloading/uploading session on the native side will be terminated once the application becomes inactive (e.g. when it goes to background).\n * Bringing the application to foreground again would trigger Promise rejection.\n */\n FOREGROUND = 1,\n}\n\nexport enum FileSystemUploadType {\n /**\n * The file will be sent as a request's body. The request can't contain additional data.\n */\n BINARY_CONTENT = 0,\n /**\n * An [RFC 2387-compliant](https://www.ietf.org/rfc/rfc2387.txt) request body. The provided file will be encoded into HTTP request.\n * This request can contain additional data represented by [`UploadOptionsMultipart`](#uploadoptionsmultipart) type.\n */\n MULTIPART = 1,\n}\n\nexport type DownloadOptions = {\n /**\n * If `true`, include the MD5 hash of the file in the returned object. Provided for convenience since it is common to check the integrity of a file immediately after downloading.\n * @default false\n */\n md5?: boolean;\n // @docsMissing\n cache?: boolean;\n /**\n * An object containing all the HTTP header fields and their values for the download network request. The keys and values of the object are the header names and values respectively.\n */\n headers?: Record<string, string>;\n /**\n * A session type. Determines if tasks can be handled in the background. On Android, sessions always work in the background and you can't change it.\n * @default FileSystemSessionType.BACKGROUND\n * @platform ios\n */\n sessionType?: FileSystemSessionType;\n};\n\nexport type FileSystemHttpResult = {\n /**\n * An object containing all the HTTP response header fields and their values for the download network request.\n * The keys and values of the object are the header names and values respectively.\n */\n headers: Record<string, string>;\n /**\n * The HTTP response status code for the download network request.\n */\n status: number;\n // @docsMissing\n mimeType: string | null;\n};\n\nexport type FileSystemDownloadResult = FileSystemHttpResult & {\n /**\n * A `file://` URI pointing to the file. This is the same as the `fileUri` input parameter.\n */\n uri: string;\n /**\n * Present if the `md5` option was truthy. Contains the MD5 hash of the file.\n */\n md5?: string;\n};\n\n/**\n * @deprecated Use `FileSystemDownloadResult` instead.\n */\nexport type DownloadResult = FileSystemDownloadResult;\n\nexport type FileSystemUploadOptions = (UploadOptionsBinary | UploadOptionsMultipart) & {\n /**\n * An object containing all the HTTP header fields and their values for the upload network request.\n * The keys and values of the object are the header names and values respectively.\n */\n headers?: Record<string, string>;\n /**\n * The request method.\n * @default FileSystemAcceptedUploadHttpMethod.POST\n */\n httpMethod?: FileSystemAcceptedUploadHttpMethod;\n /**\n * A session type. Determines if tasks can be handled in the background. On Android, sessions always work in the background and you can't change it.\n * @default FileSystemSessionType.BACKGROUND\n * @platform ios\n */\n sessionType?: FileSystemSessionType;\n};\n\n/**\n * Upload options when upload type is set to binary.\n */\nexport type UploadOptionsBinary = {\n /**\n * Upload type determines how the file will be sent to the server.\n * Value will be `FileSystemUploadType.BINARY_CONTENT`.\n */\n uploadType?: FileSystemUploadType;\n};\n\n/**\n * Upload options when upload type is set to multipart.\n */\nexport type UploadOptionsMultipart = {\n /**\n * Upload type determines how the file will be sent to the server.\n * Value will be `FileSystemUploadType.MULTIPART`.\n */\n uploadType: FileSystemUploadType;\n /**\n * The name of the field which will hold uploaded file. Defaults to the file name without an extension.\n */\n fieldName?: string;\n /**\n * The MIME type of the provided file. If not provided, the module will try to guess it based on the extension.\n */\n mimeType?: string;\n /**\n * Additional form properties. They will be located in the request body.\n */\n parameters?: Record<string, string>;\n};\n\nexport type FileSystemUploadResult = FileSystemHttpResult & {\n /**\n * The body of the server response.\n */\n body: string;\n};\n\n// @docsMissing\nexport type FileSystemNetworkTaskProgressCallback<\n T extends DownloadProgressData | UploadProgressData\n> = (data: T) => void;\n\n/**\n * @deprecated use `FileSystemNetworkTaskProgressCallback<DownloadProgressData>` instead.\n */\nexport type DownloadProgressCallback = FileSystemNetworkTaskProgressCallback<DownloadProgressData>;\n\nexport type DownloadProgressData = {\n /**\n * The total bytes written by the download operation.\n */\n totalBytesWritten: number;\n /**\n * The total bytes expected to be written by the download operation. A value of `-1` means that the server did not return the `Content-Length` header\n * and the total size is unknown. Without this header, you won't be able to track the download progress.\n */\n totalBytesExpectedToWrite: number;\n};\n\nexport type UploadProgressData = {\n /**\n * The total bytes sent by the upload operation.\n */\n totalBytesSent: number;\n /**\n * The total bytes expected to be sent by the upload operation.\n */\n totalBytesExpectedToSend: number;\n};\n\nexport type DownloadPauseState = {\n /**\n * The remote URI to download from.\n */\n url: string;\n /**\n * The local URI of the file to download to. If there is no file at this URI, a new one is created. If there is a file at this URI, its contents are replaced.\n */\n fileUri: string;\n /**\n * Object representing the file download options.\n */\n options: DownloadOptions;\n /**\n * The string which allows the API to resume a paused download.\n */\n resumeData?: string;\n};\n\n/* eslint-disable */\nexport type FileInfo =\n /**\n * Object returned when file exist.\n */\n {\n /**\n * Signifies that the requested file exist.\n */\n exists: true;\n /**\n * A `file://` URI pointing to the file. This is the same as the `fileUri` input parameter.\n */\n uri: string;\n /**\n * The size of the file in bytes. If operating on a source such as an iCloud file, only present if the `size` option was truthy.\n */\n size: number;\n /**\n * Boolean set to `true` if this is a directory and `false` if it is a file.\n */\n isDirectory: boolean;\n /**\n * The last modification time of the file expressed in seconds since epoch.\n */\n modificationTime: number;\n /**\n * Present if the `md5` option was truthy. Contains the MD5 hash of the file.\n */\n md5?: string;\n } |\n /**\n * Object returned when file do not exist.\n */\n {\n exists: false;\n uri: string;\n isDirectory: false;\n };\n/* eslint-enable */\n\n/**\n * These values can be used to define how file system data is read / written.\n */\nexport enum EncodingType {\n /**\n * Standard encoding format.\n */\n UTF8 = 'utf8',\n /**\n * Binary, radix-64 representation.\n */\n Base64 = 'base64',\n}\n\n// @docsMissing\nexport type FileSystemAcceptedUploadHttpMethod = 'POST' | 'PUT' | 'PATCH';\n\nexport type ReadingOptions = {\n /**\n * The encoding format to use when reading the file.\n * @default EncodingType.UTF8\n */\n encoding?: EncodingType | 'utf8' | 'base64';\n /**\n * Optional number of bytes to skip. This option is only used when `encoding: FileSystem.EncodingType.Base64` and `length` is defined.\n * */\n position?: number;\n /**\n * Optional number of bytes to read. This option is only used when `encoding: FileSystem.EncodingType.Base64` and `position` is defined.\n */\n length?: number;\n};\n\nexport type WritingOptions = {\n /**\n * The encoding format to use when writing the file.\n * @default FileSystem.EncodingType.UTF8\n */\n encoding?: EncodingType | 'utf8' | 'base64';\n};\n\nexport type DeletingOptions = {\n /**\n * If `true`, don't throw an error if there is no file or directory at this URI.\n * @default false\n */\n idempotent?: boolean;\n};\n\nexport type InfoOptions = {\n /**\n * Whether to return the MD5 hash of the file.\n * @default false\n */\n md5?: boolean;\n /**\n * Explicitly specify that the file size should be included. For example, skipping this can prevent downloading the file if it's stored in iCloud.\n * The size is always returned for `file://` locations.\n */\n size?: boolean;\n};\n\nexport type RelocatingOptions = {\n /**\n * URI or [SAF](#saf-uri) URI to the asset, file, or directory. See [supported URI schemes](#supported-uri-schemes-1).\n */\n from: string;\n /**\n * `file://` URI to the file or directory which should be its new location.\n */\n to: string;\n};\n\nexport type MakeDirectoryOptions = {\n /**\n * If `true`, don't throw an error if there is no file or directory at this URI.\n * @default false\n */\n intermediates?: boolean;\n};\n\n// @docsMissing\nexport type ProgressEvent<T> = {\n uuid: string;\n data: T;\n};\n\n/* eslint-disable */\nexport type FileSystemRequestDirectoryPermissionsResult =\n /**\n * If the permissions were not granted.\n */\n {\n granted: false;\n } |\n /**\n * If the permissions were granted.\n */\n {\n granted: true;\n /**\n * The [SAF URI](#saf-uri) to the user's selected directory. Available only if permissions were granted.\n */\n directoryUri: string;\n };\n/* eslint-enable */\n"]}
@@ -16,6 +16,8 @@
16
16
 
17
17
  - (EXFileSystemPermissionFlags)permissionsForURI:(NSURL *)uri;
18
18
 
19
+ - (nullable NSURL *)percentEncodedURLFromURIString:(nonnull NSString *)uri;
20
+
19
21
  - (BOOL)ensureDirExistsWithPath:(NSString *)path;
20
22
 
21
23
  - (NSString *)generatePathInDirectory:(NSString *)directory withExtension:(NSString *)extension;
@@ -35,9 +37,3 @@
35
37
  rejecter:(EXPromiseRejectBlock)reject;
36
38
 
37
39
  @end
38
-
39
- @interface NSData (EXFileSystem)
40
-
41
- - (NSString *)md5String;
42
-
43
- @end
@@ -179,7 +179,7 @@ EX_EXPORT_METHOD_AS(getInfoAsync,
179
179
  resolver:(EXPromiseResolveBlock)resolve
180
180
  rejecter:(EXPromiseRejectBlock)reject)
181
181
  {
182
- NSURL *uri = [NSURL URLWithString:uriString];
182
+ NSURL *uri = [self percentEncodedURLFromURIString:uriString];
183
183
  // no scheme provided in uri, handle as a local path and add 'file://' scheme
184
184
  if (!uri.scheme) {
185
185
  uri = [NSURL fileURLWithPath:uriString isDirectory:false];
@@ -208,7 +208,7 @@ EX_EXPORT_METHOD_AS(readAsStringAsync,
208
208
  resolver:(EXPromiseResolveBlock)resolve
209
209
  rejecter:(EXPromiseRejectBlock)reject)
210
210
  {
211
- NSURL *uri = [NSURL URLWithString:uriString];
211
+ NSURL *uri = [self percentEncodedURLFromURIString:uriString];
212
212
  // no scheme provided in uri, handle as a local path and add 'file://' scheme
213
213
  if (!uri.scheme) {
214
214
  uri = [NSURL fileURLWithPath:uriString isDirectory:false];
@@ -275,7 +275,7 @@ EX_EXPORT_METHOD_AS(writeAsStringAsync,
275
275
  resolver:(EXPromiseResolveBlock)resolve
276
276
  rejecter:(EXPromiseRejectBlock)reject)
277
277
  {
278
- NSURL *uri = [NSURL URLWithString:uriString];
278
+ NSURL *uri = [self percentEncodedURLFromURIString:uriString];
279
279
  if (!([self permissionsForURI:uri] & EXFileSystemPermissionWrite)) {
280
280
  reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
281
281
  [NSString stringWithFormat:@"File '%@' isn't writable.", uri],
@@ -335,7 +335,7 @@ EX_EXPORT_METHOD_AS(deleteAsync,
335
335
  resolver:(EXPromiseResolveBlock)resolve
336
336
  rejecter:(EXPromiseRejectBlock)reject)
337
337
  {
338
- NSURL *uri = [NSURL URLWithString:uriString];
338
+ NSURL *uri = [self percentEncodedURLFromURIString:uriString];
339
339
  if (!([self permissionsForURI:[uri URLByAppendingPathComponent:@".."]] & EXFileSystemPermissionWrite)) {
340
340
  reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
341
341
  [NSString stringWithFormat:@"Location '%@' isn't deletable.", uri],
@@ -472,8 +472,8 @@ EX_EXPORT_METHOD_AS(makeDirectoryAsync,
472
472
  rejecter:(EXPromiseRejectBlock)reject)
473
473
  {
474
474
 
475
- NSURL *uri = [NSURL URLWithString:uriString];
476
- if (!([self permissionsForURI:uri] & EXFileSystemPermissionWrite)) {
475
+ NSURL *uri = [self percentEncodedURLFromURIString:uriString];
476
+ if (!([self permissionsForURI:uri] & EXFileSystemPermissionWrite)) {
477
477
  reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
478
478
  [NSString stringWithFormat:@"Directory '%@' could not be created because the location isn't writable.", uri],
479
479
  nil);
@@ -505,7 +505,7 @@ EX_EXPORT_METHOD_AS(readDirectoryAsync,
505
505
  resolver:(EXPromiseResolveBlock)resolve
506
506
  rejecter:(EXPromiseRejectBlock)reject)
507
507
  {
508
- NSURL *uri = [NSURL URLWithString:uriString];
508
+ NSURL *uri = [self percentEncodedURLFromURIString:uriString];
509
509
  if (!([self permissionsForURI:uri] & EXFileSystemPermissionRead)) {
510
510
  reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
511
511
  [NSString stringWithFormat:@"Location '%@' isn't readable.", uri],
@@ -538,7 +538,7 @@ EX_EXPORT_METHOD_AS(downloadAsync,
538
538
  rejecter:(EXPromiseRejectBlock)reject)
539
539
  {
540
540
  NSURL *url = [NSURL URLWithString:urlString];
541
- NSURL *localUri = [NSURL URLWithString:localUriString];
541
+ NSURL *localUri = [self percentEncodedURLFromURIString:localUriString];
542
542
  if (!([self checkIfFileDirExists:localUri.path])) {
543
543
  reject(@"ERR_FILESYSTEM_WRONG_DESTINATION",
544
544
  [NSString stringWithFormat:@"Directory for '%@' doesn't exist. Please make sure directory '%@' exists before calling downloadAsync.", localUriString, [localUri.path stringByDeletingLastPathComponent]],
@@ -635,7 +635,7 @@ EX_EXPORT_METHOD_AS(uploadTaskStartAsync,
635
635
  options:(NSDictionary *)options
636
636
  rejecter:(EXPromiseRejectBlock)reject
637
637
  {
638
- NSURL *fileUri = [NSURL URLWithString:fileUriString];
638
+ NSURL *fileUri = [self percentEncodedURLFromURIString:fileUriString];
639
639
  NSString *httpMethod = options[@"httpMethod"];
640
640
  EXFileSystemUploadType type = [self _getUploadTypeFrom:options[@"uploadType"]];
641
641
  if (![fileUri.scheme isEqualToString:@"file"]) {
@@ -702,7 +702,7 @@ EX_EXPORT_METHOD_AS(downloadResumableStartAsync,
702
702
  rejecter:(EXPromiseRejectBlock)reject)
703
703
  {
704
704
  NSURL *url = [NSURL URLWithString:urlString];
705
- NSURL *localUrl = [NSURL URLWithString:fileUri];
705
+ NSURL *localUrl = [self percentEncodedURLFromURIString:fileUri];
706
706
  if (!([self checkIfFileDirExists:localUrl.path])) {
707
707
  reject(@"ERR_FILESYSTEM_WRONG_DESTINATION",
708
708
  [NSString stringWithFormat:@"Directory for '%@' doesn't exist. Please make sure directory '%@' exists before calling downloadAsync.", fileUri, [localUrl.path stringByDeletingLastPathComponent]],
@@ -1012,6 +1012,19 @@ EX_EXPORT_METHOD_AS(getTotalDiskCapacityAsync, getTotalDiskCapacityAsyncWithReso
1012
1012
  return [self _checkIfFileExists:dir];
1013
1013
  }
1014
1014
 
1015
+ /**
1016
+ Given an URI string, returns a percent-encoded URL as an NSURL object.
1017
+ Only encodes characters that are outside the set of allowed characters defined by RFC3986.
1018
+ */
1019
+ - (nullable NSURL *)percentEncodedURLFromURIString:(nonnull NSString *)uri
1020
+ {
1021
+ NSMutableCharacterSet *allowedCharacterSet = [NSMutableCharacterSet alphanumericCharacterSet];
1022
+ [allowedCharacterSet addCharactersInString:@"-._~:/?#[]@!$&'()*+,;="];
1023
+ NSString *encodedUriString = [uri stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
1024
+
1025
+ return [NSURL URLWithString:[encodedUriString stringByReplacingOccurrencesOfString:@"%25" withString:@"%"]];
1026
+ }
1027
+
1015
1028
  #pragma mark - Class methods
1016
1029
 
1017
1030
  - (BOOL)ensureDirExistsWithPath:(NSString *)path
@@ -1,5 +1,6 @@
1
1
 
2
2
  #import <EXFileSystem/EXFileSystemAssetLibraryHandler.h>
3
+ #import <EXFileSystem/NSData+EXFileSystem.h>
3
4
 
4
5
  #import <Photos/Photos.h>
5
6
 
@@ -1,5 +1,6 @@
1
1
 
2
2
  #import <EXFileSystem/EXFileSystemLocalFileHandler.h>
3
+ #import <EXFileSystem/NSData+EXFileSystem.h>
3
4
 
4
5
  @implementation EXFileSystemLocalFileHandler
5
6
 
@@ -11,15 +11,28 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
13
  s.platform = :ios, '13.0'
14
+ s.swift_version = '5.4'
14
15
  s.source = { :git => 'https://github.com/expo/expo.git' }
15
16
  s.static_framework = true
16
17
 
17
18
  s.dependency 'ExpoModulesCore'
18
19
 
20
+ # Swift/Objective-C compatibility
21
+ s.pod_target_xcconfig = {
22
+ 'DEFINES_MODULE' => 'YES',
23
+ 'SWIFT_COMPILATION_MODE' => 'wholemodule'
24
+ }
25
+
19
26
  if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
20
27
  s.source_files = "#{s.name}/**/*.h"
21
28
  s.vendored_frameworks = "#{s.name}.xcframework"
22
29
  else
23
- s.source_files = "#{s.name}/**/*.{h,m}"
30
+ s.source_files = "#{s.name}/**/*.{h,m,swift}"
31
+ end
32
+
33
+ s.exclude_files = 'Tests/'
34
+ s.test_spec 'Tests' do |test_spec|
35
+ test_spec.dependency 'ExpoModulesTestCore'
36
+ test_spec.source_files = 'Tests/**/*.{m,swift}'
24
37
  end
25
38
  end
@@ -0,0 +1,55 @@
1
+ import ExpoModulesTestCore
2
+
3
+ @testable import ExpoModulesCore
4
+ @testable import EXFileSystem
5
+
6
+ class EXFileSystemSpec: ExpoSpec {
7
+ override func spec() {
8
+ let fileSystem = EXFileSystem()
9
+
10
+ describe("percentEncodedURLFromURIString") {
11
+ it("should handle encoded URIs") {
12
+ let encodedUriInput = "file:///var/mobile/@username/branch"
13
+ let encodedUriExpectedOutput = "file:///var/mobile/@username/branch"
14
+ let encodedUri = fileSystem.percentEncodedURL(fromURIString: encodedUriInput)
15
+
16
+ expect(encodedUri?.absoluteString) == encodedUriExpectedOutput
17
+ expect(encodedUri?.scheme) == "file"
18
+ }
19
+
20
+ it("should handle UTF-8 characters") {
21
+ let utf8UriInput = "file:///var/mobile/δΈ­ζ–‡"
22
+ let utf8UriExpectedOutput = "file:///var/mobile/%E4%B8%AD%E6%96%87"
23
+ let utf8Uri = fileSystem.percentEncodedURL(fromURIString:utf8UriInput)
24
+
25
+ expect(utf8Uri?.absoluteString) == utf8UriExpectedOutput
26
+ expect(utf8Uri?.scheme) == "file"
27
+ }
28
+
29
+ it("should handle URI with percent, numbers and UTF-8 characters") {
30
+ let input = "file:///document/directory/%40%2FδΈ­ζ–‡"
31
+ let expectedOutput = "file:///document/directory/%40%2F%E4%B8%AD%E6%96%87"
32
+ let uri = fileSystem.percentEncodedURL(fromURIString:input)
33
+
34
+ expect(uri?.absoluteString) == expectedOutput
35
+ }
36
+
37
+ it("should not decode percentages in URI") {
38
+ let input = "file:///document/hello%2Fworld.txt"
39
+ let unexpectedOutput = "file:///document/hello/world.txt"
40
+ let uri = fileSystem.percentEncodedURL(fromURIString:input)
41
+
42
+ // Should not create a directory named "hello"
43
+ expect(uri?.absoluteString) != unexpectedOutput
44
+ }
45
+
46
+ it("should handle assets-library URIs") {
47
+ let assetsLibraryUriInput = "assets-library://asset/asset.JPG?id=3C1D9C54-9521-488F-BB27-AA1EA0F8AF04/L0/001&ext=JPG"
48
+ let assetsLibraryUri = fileSystem.percentEncodedURL(fromURIString:assetsLibraryUriInput)
49
+
50
+ expect(assetsLibraryUri?.absoluteString) == assetsLibraryUriInput
51
+ expect(assetsLibraryUri?.scheme) == "assets-library"
52
+ }
53
+ }
54
+ }
55
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-file-system",
3
- "version": "15.2.2",
3
+ "version": "15.3.0",
4
4
  "description": "Provides access to the local file system on the device.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "expo-module-scripts": "^3.0.0",
42
- "jest-expo": "~48.0.0"
42
+ "jest-expo": "~49.0.0-alpha.1"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "b019b92ea02e108eece600aae9fb104a3611bdeb"
47
+ "gitHead": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
48
48
  }
package/src/FileSystem.ts CHANGED
@@ -344,12 +344,6 @@ export function createUploadTask(
344
344
  return new UploadTask(url, fileUri, options, callback);
345
345
  }
346
346
 
347
- function isUploadProgressData(
348
- data: DownloadProgressData | UploadProgressData
349
- ): data is UploadProgressData {
350
- return 'totalBytesSent' in data;
351
- }
352
-
353
347
  export abstract class FileSystemCancellableNetworkTask<
354
348
  T extends DownloadProgressData | UploadProgressData
355
349
  > {
@@ -395,19 +389,6 @@ export abstract class FileSystemCancellableNetworkTask<
395
389
  if (event.uuid === this.uuid) {
396
390
  const callback = this.getCallback();
397
391
  if (callback) {
398
- if (isUploadProgressData(event.data)) {
399
- const data = {
400
- ...event.data,
401
- get totalByteSent() {
402
- console.warn(
403
- 'Key "totalByteSent" in File System UploadProgressData is deprecated and will be removed in SDK 49, use "totalBytesSent" instead'
404
- );
405
- return this.totalBytesSent;
406
- },
407
- };
408
- return callback(data);
409
- }
410
-
411
392
  callback(event.data);
412
393
  }
413
394
  }
@@ -165,10 +165,6 @@ export type UploadProgressData = {
165
165
  * The total bytes sent by the upload operation.
166
166
  */
167
167
  totalBytesSent: number;
168
- /**
169
- * @deprecated Use `totalBytesSent` instead.
170
- */
171
- totalByteSent: number;
172
168
  /**
173
169
  * The total bytes expected to be sent by the upload operation.
174
170
  */