@capacitor/filesystem 5.1.2-nightly-20230809T150556.0 → 5.1.3-nightly-20230810T150553.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/README.md CHANGED
@@ -387,9 +387,9 @@ Add a listener to file download progress events.
387
387
 
388
388
  #### ReadFileResult
389
389
 
390
- | Prop | Type | Description | Since |
391
- | ---------- | ------------------- | ----------------------------------------------------------- | ----- |
392
- | **`data`** | <code>string</code> | The string representation of the data contained in the file | 1.0.0 |
390
+ | Prop | Type | Description | Since |
391
+ | ---------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----- |
392
+ | **`data`** | <code>string \| Blob</code> | The representation of the data contained in the file Note: Blob is only available on Web. On native, the data is returned as a string. | 1.0.0 |
393
393
 
394
394
 
395
395
  #### ReadFileOptions
@@ -413,7 +413,7 @@ Add a listener to file download progress events.
413
413
  | Prop | Type | Description | Default | Since |
414
414
  | --------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
415
415
  | **`path`** | <code>string</code> | The path of the file to write | | 1.0.0 |
416
- | **`data`** | <code>string</code> | The data to write | | 1.0.0 |
416
+ | **`data`** | <code>string \| Blob</code> | The data to write Note: Blob data is only supported on Web. | | 1.0.0 |
417
417
  | **`directory`** | <code><a href="#directory">Directory</a></code> | The <a href="#directory">`Directory`</a> to store the file in | | 1.0.0 |
418
418
  | **`encoding`** | <code><a href="#encoding">Encoding</a></code> | The encoding to write the file in. If not provided, data is written as base64 encoded. Pass <a href="#encoding">Encoding.UTF8</a> to write data as string | | 1.0.0 |
419
419
  | **`recursive`** | <code>boolean</code> | Whether to create any missing parent directories. | <code>false</code> | 1.0.0 |
@@ -550,11 +550,12 @@ Add a listener to file download progress events.
550
550
 
551
551
  #### DownloadFileOptions
552
552
 
553
- | Prop | Type | Description | Since |
554
- | --------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
555
- | **`path`** | <code>string</code> | The path the downloaded file should be moved to. | 5.1.0 |
556
- | **`directory`** | <code><a href="#directory">Directory</a></code> | The directory to write the file to. If this option is used, filePath can be a relative path rather than absolute. The default is the `DATA` directory. | 5.1.0 |
557
- | **`progress`** | <code>boolean</code> | An optional listener function to receive downloaded progress events. If this option is used, progress event should be dispatched on every chunk received. Chunks are throttled to every 100ms on Android/iOS to avoid slowdowns. | 5.1.0 |
553
+ | Prop | Type | Description | Default | Since |
554
+ | --------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
555
+ | **`path`** | <code>string</code> | The path the downloaded file should be moved to. | | 5.1.0 |
556
+ | **`directory`** | <code><a href="#directory">Directory</a></code> | The directory to write the file to. If this option is used, filePath can be a relative path rather than absolute. The default is the `DATA` directory. | | 5.1.0 |
557
+ | **`progress`** | <code>boolean</code> | An optional listener function to receive downloaded progress events. If this option is used, progress event should be dispatched on every chunk received. Chunks are throttled to every 100ms on Android/iOS to avoid slowdowns. | | 5.1.0 |
558
+ | **`recursive`** | <code>boolean</code> | Whether to create any missing parent directories. | <code>false</code> | 5.1.2 |
558
559
 
559
560
 
560
561
  #### PluginListenerHandle
@@ -399,6 +399,10 @@ public class FilesystemPlugin extends Plugin {
399
399
  };
400
400
 
401
401
  JSObject response = implementation.downloadFile(call, bridge, emitter);
402
+ // update mediaStore index only if file was written to external storage
403
+ if (isPublicDirectory(directory)) {
404
+ MediaScannerConnection.scanFile(getContext(), new String[] { response.getString("path") }, null, null);
405
+ }
402
406
  call.resolve(response);
403
407
  }
404
408
  } catch (Exception ex) {
package/dist/docs.json CHANGED
@@ -370,9 +370,11 @@
370
370
  "name": "since"
371
371
  }
372
372
  ],
373
- "docs": "The string representation of the data contained in the file",
374
- "complexTypes": [],
375
- "type": "string"
373
+ "docs": "The representation of the data contained in the file\n\nNote: Blob is only available on Web. On native, the data is returned as a string.",
374
+ "complexTypes": [
375
+ "Blob"
376
+ ],
377
+ "type": "string | Blob"
376
378
  }
377
379
  ]
378
380
  },
@@ -473,9 +475,11 @@
473
475
  "name": "since"
474
476
  }
475
477
  ],
476
- "docs": "The data to write",
477
- "complexTypes": [],
478
- "type": "string"
478
+ "docs": "The data to write\n\nNote: Blob data is only supported on Web.",
479
+ "complexTypes": [
480
+ "Blob"
481
+ ],
482
+ "type": "string | Blob"
479
483
  },
480
484
  {
481
485
  "name": "directory",
@@ -1194,6 +1198,22 @@
1194
1198
  "docs": "An optional listener function to receive downloaded progress events.\nIf this option is used, progress event should be dispatched on every chunk received.\nChunks are throttled to every 100ms on Android/iOS to avoid slowdowns.",
1195
1199
  "complexTypes": [],
1196
1200
  "type": "boolean | undefined"
1201
+ },
1202
+ {
1203
+ "name": "recursive",
1204
+ "tags": [
1205
+ {
1206
+ "text": "false",
1207
+ "name": "default"
1208
+ },
1209
+ {
1210
+ "text": "5.1.2",
1211
+ "name": "since"
1212
+ }
1213
+ ],
1214
+ "docs": "Whether to create any missing parent directories.",
1215
+ "complexTypes": [],
1216
+ "type": "boolean | undefined"
1197
1217
  }
1198
1218
  ]
1199
1219
  },
@@ -101,9 +101,11 @@ export interface WriteFileOptions {
101
101
  /**
102
102
  * The data to write
103
103
  *
104
+ * Note: Blob data is only supported on Web.
105
+ *
104
106
  * @since 1.0.0
105
107
  */
106
- data: string;
108
+ data: string | Blob;
107
109
  /**
108
110
  * The `Directory` to store the file in
109
111
  *
@@ -307,11 +309,13 @@ export interface CopyOptions {
307
309
  export declare type RenameOptions = CopyOptions;
308
310
  export interface ReadFileResult {
309
311
  /**
310
- * The string representation of the data contained in the file
312
+ * The representation of the data contained in the file
313
+ *
314
+ * Note: Blob is only available on Web. On native, the data is returned as a string.
311
315
  *
312
316
  * @since 1.0.0
313
317
  */
314
- data: string;
318
+ data: string | Blob;
315
319
  }
316
320
  export interface WriteFileResult {
317
321
  /**
@@ -440,6 +444,13 @@ export interface DownloadFileOptions extends HttpOptions {
440
444
  * @since 5.1.0
441
445
  */
442
446
  progress?: boolean;
447
+ /**
448
+ * Whether to create any missing parent directories.
449
+ *
450
+ * @default false
451
+ * @since 5.1.2
452
+ */
453
+ recursive?: boolean;
443
454
  }
444
455
  export interface DownloadFileResult {
445
456
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,SAqEX;AArED,WAAY,SAAS;IACnB;;;;;;;;;;;OAWG;IACH,oCAAuB,CAAA;IAEvB;;;;;;;OAOG;IACH,0BAAa,CAAA;IAEb;;;;;;;OAOG;IACH,gCAAmB,CAAA;IAEnB;;;;;;OAMG;IACH,4BAAe,CAAA;IAEf;;;;;;;;;;OAUG;IACH,kCAAqB,CAAA;IAErB;;;;;;;;;;OAUG;IACH,iDAAoC,CAAA;AACtC,CAAC,EArEW,SAAS,KAAT,SAAS,QAqEpB;AAED,MAAM,CAAN,IAAY,QAyBX;AAzBD,WAAY,QAAQ;IAClB;;;;OAIG;IACH,yBAAa,CAAA;IAEb;;;;;;OAMG;IACH,2BAAe,CAAA;IAEf;;;;;;OAMG;IACH,2BAAe,CAAA;AACjB,CAAC,EAzBW,QAAQ,KAAR,QAAQ,QAyBnB;AAglBD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["import type {\n HttpOptions,\n PermissionState,\n PluginListenerHandle,\n} from '@capacitor/core';\n\nexport interface PermissionStatus {\n publicStorage: PermissionState;\n}\n\nexport enum Directory {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Documents = 'DOCUMENTS',\n\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Data = 'DATA',\n\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Library = 'LIBRARY',\n\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Cache = 'CACHE',\n\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n External = 'EXTERNAL',\n\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n ExternalStorage = 'EXTERNAL_STORAGE',\n}\n\nexport enum Encoding {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n UTF8 = 'utf8',\n\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n ASCII = 'ascii',\n\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n UTF16 = 'utf16',\n}\n\nexport interface WriteFileOptions {\n /**\n * The path of the file to write\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The data to write\n *\n * @since 1.0.0\n */\n data: string;\n\n /**\n * The `Directory` to store the file in\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The encoding to write the file in. If not provided, data\n * is written as base64 encoded.\n *\n * Pass Encoding.UTF8 to write data as string\n *\n * @since 1.0.0\n */\n encoding?: Encoding;\n\n /**\n * Whether to create any missing parent directories.\n *\n * @default false\n * @since 1.0.0\n */\n recursive?: boolean;\n}\n\nexport interface AppendFileOptions {\n /**\n * The path of the file to append\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The data to write\n *\n * @since 1.0.0\n */\n data: string;\n\n /**\n * The `Directory` to store the file in\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The encoding to write the file in. If not provided, data\n * is written as base64 encoded.\n *\n * Pass Encoding.UTF8 to write data as string\n *\n * @since 1.0.0\n */\n encoding?: Encoding;\n}\n\nexport interface ReadFileOptions {\n /**\n * The path of the file to read\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to read the file from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The encoding to read the file in, if not provided, data\n * is read as binary and returned as base64 encoded.\n *\n * Pass Encoding.UTF8 to read data as string\n *\n * @since 1.0.0\n */\n encoding?: Encoding;\n}\n\nexport interface DeleteFileOptions {\n /**\n * The path of the file to delete\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to delete the file from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n}\n\nexport interface MkdirOptions {\n /**\n * The path of the new directory\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to make the new directory in\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * Whether to create any missing parent directories as well.\n *\n * @default false\n * @since 1.0.0\n */\n recursive?: boolean;\n}\n\nexport interface RmdirOptions {\n /**\n * The path of the directory to remove\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to remove the directory from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * Whether to recursively remove the contents of the directory\n *\n * @default false\n * @since 1.0.0\n */\n recursive?: boolean;\n}\n\nexport interface ReaddirOptions {\n /**\n * The path of the directory to read\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to list files from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n}\n\nexport interface GetUriOptions {\n /**\n * The path of the file to get the URI for\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to get the file under\n *\n * @since 1.0.0\n */\n directory: Directory;\n}\n\nexport interface StatOptions {\n /**\n * The path of the file to get data about\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to get the file under\n *\n * @since 1.0.0\n */\n directory?: Directory;\n}\n\nexport interface CopyOptions {\n /**\n * The existing file or directory\n *\n * @since 1.0.0\n */\n from: string;\n\n /**\n * The destination file or directory\n *\n * @since 1.0.0\n */\n to: string;\n\n /**\n * The `Directory` containing the existing file or directory\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The `Directory` containing the destination file or directory. If not supplied will use the 'directory'\n * parameter as the destination\n *\n * @since 1.0.0\n */\n toDirectory?: Directory;\n}\n\nexport type RenameOptions = CopyOptions;\n\nexport interface ReadFileResult {\n /**\n * The string representation of the data contained in the file\n *\n * @since 1.0.0\n */\n data: string;\n}\n\nexport interface WriteFileResult {\n /**\n * The uri where the file was written into\n *\n * @since 1.0.0\n */\n uri: string;\n}\n\nexport interface ReaddirResult {\n /**\n * List of files and directories inside the directory\n *\n * @since 1.0.0\n */\n files: FileInfo[];\n}\n\nexport interface FileInfo {\n /**\n * Name of the file or directory.\n */\n name: string;\n /**\n * Type of the file.\n *\n * @since 4.0.0\n */\n type: 'directory' | 'file';\n\n /**\n * Size of the file in bytes.\n *\n * @since 4.0.0\n */\n size: number;\n\n /**\n * Time of creation in milliseconds.\n *\n * It's not available on Android 7 and older devices.\n *\n * @since 4.0.0\n */\n ctime?: number;\n\n /**\n * Time of last modification in milliseconds.\n *\n * @since 4.0.0\n */\n mtime: number;\n\n /**\n * The uri of the file.\n *\n * @since 4.0.0\n */\n uri: string;\n}\n\nexport interface GetUriResult {\n /**\n * The uri of the file\n *\n * @since 1.0.0\n */\n uri: string;\n}\n\nexport interface StatResult {\n /**\n * Type of the file.\n *\n * @since 1.0.0\n */\n type: 'directory' | 'file';\n\n /**\n * Size of the file in bytes.\n *\n * @since 1.0.0\n */\n size: number;\n\n /**\n * Time of creation in milliseconds.\n *\n * It's not available on Android 7 and older devices.\n *\n * @since 1.0.0\n */\n ctime?: number;\n\n /**\n * Time of last modification in milliseconds.\n *\n * @since 1.0.0\n */\n mtime: number;\n\n /**\n * The uri of the file\n *\n * @since 1.0.0\n */\n uri: string;\n}\n\nexport interface CopyResult {\n /**\n * The uri where the file was copied into\n *\n * @since 4.0.0\n */\n uri: string;\n}\n\nexport interface DownloadFileOptions extends HttpOptions {\n /**\n * The path the downloaded file should be moved to.\n *\n * @since 5.1.0\n */\n path: string;\n /**\n * The directory to write the file to.\n * If this option is used, filePath can be a relative path rather than absolute.\n * The default is the `DATA` directory.\n *\n * @since 5.1.0\n */\n directory?: Directory;\n /**\n * An optional listener function to receive downloaded progress events.\n * If this option is used, progress event should be dispatched on every chunk received.\n * Chunks are throttled to every 100ms on Android/iOS to avoid slowdowns.\n *\n * @since 5.1.0\n */\n progress?: boolean;\n}\n\nexport interface DownloadFileResult {\n /**\n * The path the file was downloaded to.\n *\n * @since 5.1.0\n */\n path?: string;\n /**\n * The blob data of the downloaded file.\n * This is only available on web.\n *\n * @since 5.1.0\n */\n blob?: Blob;\n}\nexport interface ProgressStatus {\n /**\n * The url of the file being downloaded.\n *\n * @since 5.1.0\n */\n url: string;\n /**\n * The number of bytes downloaded so far.\n *\n * @since 5.1.0\n */\n bytes: number;\n /**\n * The total number of bytes to download for this file.\n *\n * @since 5.1.0\n */\n contentLength: number;\n}\n\n/**\n * A listener function that receives progress events.\n *\n * @since 5.1.0\n */\nexport type ProgressListener = (progress: ProgressStatus) => void;\n\nexport interface FilesystemPlugin {\n /**\n * Read a file from disk\n *\n * @since 1.0.0\n */\n readFile(options: ReadFileOptions): Promise<ReadFileResult>;\n\n /**\n * Write a file to disk in the specified location on device\n *\n * @since 1.0.0\n */\n writeFile(options: WriteFileOptions): Promise<WriteFileResult>;\n\n /**\n * Append to a file on disk in the specified location on device\n *\n * @since 1.0.0\n */\n appendFile(options: AppendFileOptions): Promise<void>;\n\n /**\n * Delete a file from disk\n *\n * @since 1.0.0\n */\n deleteFile(options: DeleteFileOptions): Promise<void>;\n\n /**\n * Create a directory.\n *\n * @since 1.0.0\n */\n mkdir(options: MkdirOptions): Promise<void>;\n\n /**\n * Remove a directory\n *\n * @since 1.0.0\n */\n rmdir(options: RmdirOptions): Promise<void>;\n\n /**\n * Return a list of files from the directory (not recursive)\n *\n * @since 1.0.0\n */\n readdir(options: ReaddirOptions): Promise<ReaddirResult>;\n\n /**\n * Return full File URI for a path and directory\n *\n * @since 1.0.0\n */\n getUri(options: GetUriOptions): Promise<GetUriResult>;\n\n /**\n * Return data about a file\n *\n * @since 1.0.0\n */\n stat(options: StatOptions): Promise<StatResult>;\n\n /**\n * Rename a file or directory\n *\n * @since 1.0.0\n */\n rename(options: RenameOptions): Promise<void>;\n\n /**\n * Copy a file or directory\n *\n * @since 1.0.0\n */\n copy(options: CopyOptions): Promise<CopyResult>;\n\n /**\n * Check read/write permissions.\n * Required on Android, only when using `Directory.Documents` or\n * `Directory.ExternalStorage`.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request read/write permissions.\n * Required on Android, only when using `Directory.Documents` or\n * `Directory.ExternalStorage`.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Perform a http request to a server and download the file to the specified destination.\n *\n * @since 5.1.0\n */\n downloadFile(options: DownloadFileOptions): Promise<DownloadFileResult>;\n\n /**\n * Add a listener to file download progress events.\n *\n * @since 5.1.0\n */\n addListener(\n eventName: 'progress',\n listenerFunc: ProgressListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n}\n\n/**\n * @deprecated Use `ReadFileOptions`.\n * @since 1.0.0\n */\nexport type FileReadOptions = ReadFileOptions;\n\n/**\n * @deprecated Use `ReadFileResult`.\n * @since 1.0.0\n */\nexport type FileReadResult = ReadFileResult;\n\n/**\n * @deprecated Use `WriteFileOptions`.\n * @since 1.0.0\n */\nexport type FileWriteOptions = WriteFileOptions;\n\n/**\n * @deprecated Use `WriteFileResult`.\n * @since 1.0.0\n */\nexport type FileWriteResult = WriteFileResult;\n\n/**\n * @deprecated Use `AppendFileOptions`.\n * @since 1.0.0\n */\nexport type FileAppendOptions = AppendFileOptions;\n\n/**\n * @deprecated Use `DeleteFileOptions`.\n * @since 1.0.0\n */\nexport type FileDeleteOptions = DeleteFileOptions;\n\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,SAqEX;AArED,WAAY,SAAS;IACnB;;;;;;;;;;;OAWG;IACH,oCAAuB,CAAA;IAEvB;;;;;;;OAOG;IACH,0BAAa,CAAA;IAEb;;;;;;;OAOG;IACH,gCAAmB,CAAA;IAEnB;;;;;;OAMG;IACH,4BAAe,CAAA;IAEf;;;;;;;;;;OAUG;IACH,kCAAqB,CAAA;IAErB;;;;;;;;;;OAUG;IACH,iDAAoC,CAAA;AACtC,CAAC,EArEW,SAAS,KAAT,SAAS,QAqEpB;AAED,MAAM,CAAN,IAAY,QAyBX;AAzBD,WAAY,QAAQ;IAClB;;;;OAIG;IACH,yBAAa,CAAA;IAEb;;;;;;OAMG;IACH,2BAAe,CAAA;IAEf;;;;;;OAMG;IACH,2BAAe,CAAA;AACjB,CAAC,EAzBW,QAAQ,KAAR,QAAQ,QAyBnB;AA2lBD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["import type {\n HttpOptions,\n PermissionState,\n PluginListenerHandle,\n} from '@capacitor/core';\n\nexport interface PermissionStatus {\n publicStorage: PermissionState;\n}\n\nexport enum Directory {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Documents = 'DOCUMENTS',\n\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Data = 'DATA',\n\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Library = 'LIBRARY',\n\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Cache = 'CACHE',\n\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n External = 'EXTERNAL',\n\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n ExternalStorage = 'EXTERNAL_STORAGE',\n}\n\nexport enum Encoding {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n UTF8 = 'utf8',\n\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n ASCII = 'ascii',\n\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n UTF16 = 'utf16',\n}\n\nexport interface WriteFileOptions {\n /**\n * The path of the file to write\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The data to write\n *\n * Note: Blob data is only supported on Web.\n *\n * @since 1.0.0\n */\n data: string | Blob;\n\n /**\n * The `Directory` to store the file in\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The encoding to write the file in. If not provided, data\n * is written as base64 encoded.\n *\n * Pass Encoding.UTF8 to write data as string\n *\n * @since 1.0.0\n */\n encoding?: Encoding;\n\n /**\n * Whether to create any missing parent directories.\n *\n * @default false\n * @since 1.0.0\n */\n recursive?: boolean;\n}\n\nexport interface AppendFileOptions {\n /**\n * The path of the file to append\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The data to write\n *\n * @since 1.0.0\n */\n data: string;\n\n /**\n * The `Directory` to store the file in\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The encoding to write the file in. If not provided, data\n * is written as base64 encoded.\n *\n * Pass Encoding.UTF8 to write data as string\n *\n * @since 1.0.0\n */\n encoding?: Encoding;\n}\n\nexport interface ReadFileOptions {\n /**\n * The path of the file to read\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to read the file from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The encoding to read the file in, if not provided, data\n * is read as binary and returned as base64 encoded.\n *\n * Pass Encoding.UTF8 to read data as string\n *\n * @since 1.0.0\n */\n encoding?: Encoding;\n}\n\nexport interface DeleteFileOptions {\n /**\n * The path of the file to delete\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to delete the file from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n}\n\nexport interface MkdirOptions {\n /**\n * The path of the new directory\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to make the new directory in\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * Whether to create any missing parent directories as well.\n *\n * @default false\n * @since 1.0.0\n */\n recursive?: boolean;\n}\n\nexport interface RmdirOptions {\n /**\n * The path of the directory to remove\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to remove the directory from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * Whether to recursively remove the contents of the directory\n *\n * @default false\n * @since 1.0.0\n */\n recursive?: boolean;\n}\n\nexport interface ReaddirOptions {\n /**\n * The path of the directory to read\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to list files from\n *\n * @since 1.0.0\n */\n directory?: Directory;\n}\n\nexport interface GetUriOptions {\n /**\n * The path of the file to get the URI for\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to get the file under\n *\n * @since 1.0.0\n */\n directory: Directory;\n}\n\nexport interface StatOptions {\n /**\n * The path of the file to get data about\n *\n * @since 1.0.0\n */\n path: string;\n\n /**\n * The `Directory` to get the file under\n *\n * @since 1.0.0\n */\n directory?: Directory;\n}\n\nexport interface CopyOptions {\n /**\n * The existing file or directory\n *\n * @since 1.0.0\n */\n from: string;\n\n /**\n * The destination file or directory\n *\n * @since 1.0.0\n */\n to: string;\n\n /**\n * The `Directory` containing the existing file or directory\n *\n * @since 1.0.0\n */\n directory?: Directory;\n\n /**\n * The `Directory` containing the destination file or directory. If not supplied will use the 'directory'\n * parameter as the destination\n *\n * @since 1.0.0\n */\n toDirectory?: Directory;\n}\n\nexport type RenameOptions = CopyOptions;\n\nexport interface ReadFileResult {\n /**\n * The representation of the data contained in the file\n *\n * Note: Blob is only available on Web. On native, the data is returned as a string.\n *\n * @since 1.0.0\n */\n data: string | Blob;\n}\n\nexport interface WriteFileResult {\n /**\n * The uri where the file was written into\n *\n * @since 1.0.0\n */\n uri: string;\n}\n\nexport interface ReaddirResult {\n /**\n * List of files and directories inside the directory\n *\n * @since 1.0.0\n */\n files: FileInfo[];\n}\n\nexport interface FileInfo {\n /**\n * Name of the file or directory.\n */\n name: string;\n /**\n * Type of the file.\n *\n * @since 4.0.0\n */\n type: 'directory' | 'file';\n\n /**\n * Size of the file in bytes.\n *\n * @since 4.0.0\n */\n size: number;\n\n /**\n * Time of creation in milliseconds.\n *\n * It's not available on Android 7 and older devices.\n *\n * @since 4.0.0\n */\n ctime?: number;\n\n /**\n * Time of last modification in milliseconds.\n *\n * @since 4.0.0\n */\n mtime: number;\n\n /**\n * The uri of the file.\n *\n * @since 4.0.0\n */\n uri: string;\n}\n\nexport interface GetUriResult {\n /**\n * The uri of the file\n *\n * @since 1.0.0\n */\n uri: string;\n}\n\nexport interface StatResult {\n /**\n * Type of the file.\n *\n * @since 1.0.0\n */\n type: 'directory' | 'file';\n\n /**\n * Size of the file in bytes.\n *\n * @since 1.0.0\n */\n size: number;\n\n /**\n * Time of creation in milliseconds.\n *\n * It's not available on Android 7 and older devices.\n *\n * @since 1.0.0\n */\n ctime?: number;\n\n /**\n * Time of last modification in milliseconds.\n *\n * @since 1.0.0\n */\n mtime: number;\n\n /**\n * The uri of the file\n *\n * @since 1.0.0\n */\n uri: string;\n}\n\nexport interface CopyResult {\n /**\n * The uri where the file was copied into\n *\n * @since 4.0.0\n */\n uri: string;\n}\n\nexport interface DownloadFileOptions extends HttpOptions {\n /**\n * The path the downloaded file should be moved to.\n *\n * @since 5.1.0\n */\n path: string;\n /**\n * The directory to write the file to.\n * If this option is used, filePath can be a relative path rather than absolute.\n * The default is the `DATA` directory.\n *\n * @since 5.1.0\n */\n directory?: Directory;\n /**\n * An optional listener function to receive downloaded progress events.\n * If this option is used, progress event should be dispatched on every chunk received.\n * Chunks are throttled to every 100ms on Android/iOS to avoid slowdowns.\n *\n * @since 5.1.0\n */\n progress?: boolean;\n /**\n * Whether to create any missing parent directories.\n *\n * @default false\n * @since 5.1.2\n */\n recursive?: boolean;\n}\n\nexport interface DownloadFileResult {\n /**\n * The path the file was downloaded to.\n *\n * @since 5.1.0\n */\n path?: string;\n /**\n * The blob data of the downloaded file.\n * This is only available on web.\n *\n * @since 5.1.0\n */\n blob?: Blob;\n}\nexport interface ProgressStatus {\n /**\n * The url of the file being downloaded.\n *\n * @since 5.1.0\n */\n url: string;\n /**\n * The number of bytes downloaded so far.\n *\n * @since 5.1.0\n */\n bytes: number;\n /**\n * The total number of bytes to download for this file.\n *\n * @since 5.1.0\n */\n contentLength: number;\n}\n\n/**\n * A listener function that receives progress events.\n *\n * @since 5.1.0\n */\nexport type ProgressListener = (progress: ProgressStatus) => void;\n\nexport interface FilesystemPlugin {\n /**\n * Read a file from disk\n *\n * @since 1.0.0\n */\n readFile(options: ReadFileOptions): Promise<ReadFileResult>;\n\n /**\n * Write a file to disk in the specified location on device\n *\n * @since 1.0.0\n */\n writeFile(options: WriteFileOptions): Promise<WriteFileResult>;\n\n /**\n * Append to a file on disk in the specified location on device\n *\n * @since 1.0.0\n */\n appendFile(options: AppendFileOptions): Promise<void>;\n\n /**\n * Delete a file from disk\n *\n * @since 1.0.0\n */\n deleteFile(options: DeleteFileOptions): Promise<void>;\n\n /**\n * Create a directory.\n *\n * @since 1.0.0\n */\n mkdir(options: MkdirOptions): Promise<void>;\n\n /**\n * Remove a directory\n *\n * @since 1.0.0\n */\n rmdir(options: RmdirOptions): Promise<void>;\n\n /**\n * Return a list of files from the directory (not recursive)\n *\n * @since 1.0.0\n */\n readdir(options: ReaddirOptions): Promise<ReaddirResult>;\n\n /**\n * Return full File URI for a path and directory\n *\n * @since 1.0.0\n */\n getUri(options: GetUriOptions): Promise<GetUriResult>;\n\n /**\n * Return data about a file\n *\n * @since 1.0.0\n */\n stat(options: StatOptions): Promise<StatResult>;\n\n /**\n * Rename a file or directory\n *\n * @since 1.0.0\n */\n rename(options: RenameOptions): Promise<void>;\n\n /**\n * Copy a file or directory\n *\n * @since 1.0.0\n */\n copy(options: CopyOptions): Promise<CopyResult>;\n\n /**\n * Check read/write permissions.\n * Required on Android, only when using `Directory.Documents` or\n * `Directory.ExternalStorage`.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request read/write permissions.\n * Required on Android, only when using `Directory.Documents` or\n * `Directory.ExternalStorage`.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Perform a http request to a server and download the file to the specified destination.\n *\n * @since 5.1.0\n */\n downloadFile(options: DownloadFileOptions): Promise<DownloadFileResult>;\n\n /**\n * Add a listener to file download progress events.\n *\n * @since 5.1.0\n */\n addListener(\n eventName: 'progress',\n listenerFunc: ProgressListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n}\n\n/**\n * @deprecated Use `ReadFileOptions`.\n * @since 1.0.0\n */\nexport type FileReadOptions = ReadFileOptions;\n\n/**\n * @deprecated Use `ReadFileResult`.\n * @since 1.0.0\n */\nexport type FileReadResult = ReadFileResult;\n\n/**\n * @deprecated Use `WriteFileOptions`.\n * @since 1.0.0\n */\nexport type FileWriteOptions = WriteFileOptions;\n\n/**\n * @deprecated Use `WriteFileResult`.\n * @since 1.0.0\n */\nexport type FileWriteResult = WriteFileResult;\n\n/**\n * @deprecated Use `AppendFileOptions`.\n * @since 1.0.0\n */\nexport type FileAppendOptions = AppendFileOptions;\n\n/**\n * @deprecated Use `DeleteFileOptions`.\n * @since 1.0.0\n */\nexport type FileDeleteOptions = DeleteFileOptions;\n\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n"]}
package/dist/esm/web.js CHANGED
@@ -36,10 +36,11 @@ export class FilesystemWeb extends WebPlugin {
36
36
  * @returns a promise that resolves with the download file result
37
37
  */
38
38
  this.downloadFile = async (options) => {
39
+ var _a, _b;
39
40
  const requestInit = buildRequestInit(options, options.webFetchExtra);
40
41
  const response = await fetch(options.url, requestInit);
41
42
  let blob;
42
- if (!(options === null || options === void 0 ? void 0 : options.progress))
43
+ if (!options.progress)
43
44
  blob = await response.blob();
44
45
  else if (!(response === null || response === void 0 ? void 0 : response.body))
45
46
  blob = new Blob();
@@ -72,15 +73,13 @@ export class FilesystemWeb extends WebPlugin {
72
73
  }
73
74
  blob = new Blob([allChunks.buffer], { type: contentType || undefined });
74
75
  }
75
- const blobUrl = URL.createObjectURL(blob);
76
- const tempAnchor = document.createElement('a');
77
- document.body.appendChild(tempAnchor);
78
- tempAnchor.href = blobUrl;
79
- tempAnchor.download = options.path; // This should be a filename, not a path
80
- tempAnchor.click();
81
- URL.revokeObjectURL(blobUrl);
82
- document.body.removeChild(tempAnchor);
83
- return { path: options.path, blob };
76
+ const result = await this.writeFile({
77
+ path: options.path,
78
+ directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,
79
+ recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,
80
+ data: blob,
81
+ });
82
+ return { path: result.uri, blob };
84
83
  };
85
84
  }
86
85
  async initDb() {
@@ -197,7 +196,7 @@ export class FilesystemWeb extends WebPlugin {
197
196
  });
198
197
  }
199
198
  }
200
- if (!encoding) {
199
+ if (!encoding && !(data instanceof Blob)) {
201
200
  data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;
202
201
  if (!this.isBase64String(data))
203
202
  throw Error('The supplied data is not valid base64 content.');
@@ -207,7 +206,7 @@ export class FilesystemWeb extends WebPlugin {
207
206
  path: path,
208
207
  folder: parentPath,
209
208
  type: 'file',
210
- size: data.length,
209
+ size: data instanceof Blob ? data.size : data.length,
211
210
  ctime: now,
212
211
  mtime: now,
213
212
  content: data,
@@ -247,6 +246,9 @@ export class FilesystemWeb extends WebPlugin {
247
246
  if (!encoding && !this.isBase64String(data))
248
247
  throw Error('The supplied data is not valid base64 content.');
249
248
  if (occupiedEntry !== undefined) {
249
+ if (occupiedEntry.content instanceof Blob) {
250
+ throw Error('The occupied entry contains a Blob object which cannot be appended to.');
251
+ }
250
252
  if (occupiedEntry.content !== undefined && !encoding) {
251
253
  data = btoa(atob(occupiedEntry.content) + atob(data));
252
254
  }
@@ -518,7 +520,7 @@ export class FilesystemWeb extends WebPlugin {
518
520
  });
519
521
  }
520
522
  let encoding;
521
- if (!this.isBase64String(file.data)) {
523
+ if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {
522
524
  encoding = Encoding.UTF8;
523
525
  }
524
526
  // Write the file to the new location
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA2B9D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,IACE,IAAI,KAAK,IAAI;YACb,QAAQ,CAAC,MAAM,GAAG,CAAC;YACnB,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EACtC;YACA,QAAQ,CAAC,GAAG,EAAE,CAAC;SAChB;aAAM;YACL,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;I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E;wBACR,SAAS,EAAE,WAAW;wBACtB,SAAS,EAAE,KAAK;qBACjB,CAAC,CAAC;oBAEH,8CAA8C;oBAC9C,IAAI,QAAQ,EAAE;wBACZ,MAAM,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;qBAC5C;iBACF;gBAAC,OAAO,CAAC,EAAE;oBACV,SAAS;iBACV;gBAED,iDAAiD;gBACjD,MAAM,QAAQ,GAAG,CACf,MAAM,IAAI,CAAC,OAAO,CAAC;oBACjB,IAAI,EAAE,IAAI;oBACV,SAAS,EAAE,aAAa;iBACzB,CAAC,CACH,CAAC,KAAK,CAAC;gBAER,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE;oBAC/B,wDAAwD;oBACxD,MAAM,IAAI,CAAC,KAAK,CACd;wBACE,IAAI,EAAE,GAAG,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE;wBAChC,EAAE,EAAE,GAAG,EAAE,IAAI,QAAQ,CAAC,IAAI,EAAE;wBAC5B,SAAS,EAAE,aAAa;wBACxB,WAAW;qBACZ,EACD,QAAQ,CACT,CAAC;iBACH;gBAED,gDAAgD;gBAChD,IAAI,QAAQ,EAAE;oBACZ,MAAM,IAAI,CAAC,KAAK,CAAC;wBACf,IAAI,EAAE,IAAI;wBACV,SAAS,EAAE,aAAa;qBACzB,CAAC,CAAC;iBACJ;aACF;SACF;QACD,OAAO;YACL,GAAG,EAAE,MAAM;SACZ,CAAC;IACJ,CAAC;IAwEO,cAAc,CAAC,GAAW;QAChC,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC;SAC/B;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,KAAK,CAAC;SACd;IACH,CAAC;;AAlpBM,oBAAM,GAAG,IAAI,CAAC","sourcesContent":["import { WebPlugin, buildRequestInit } from '@capacitor/core';\n\nimport type {\n AppendFileOptions,\n CopyOptions,\n CopyResult,\n DeleteFileOptions,\n FilesystemPlugin,\n GetUriOptions,\n GetUriResult,\n MkdirOptions,\n PermissionStatus,\n ReadFileOptions,\n ReadFileResult,\n ReaddirOptions,\n ReaddirResult,\n RenameOptions,\n RmdirOptions,\n StatOptions,\n StatResult,\n WriteFileOptions,\n WriteFileResult,\n Directory,\n DownloadFileOptions,\n DownloadFileResult,\n ProgressStatus,\n} from './definitions';\nimport { Encoding } from './definitions';\n\nfunction resolve(path: string): string {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix: string[] = [];\n\n posix.forEach(item => {\n if (\n item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..'\n ) {\n newPosix.pop();\n } else {\n newPosix.push(item);\n }\n });\n\n return newPosix.join('/');\n}\nfunction isPathParent(parent: string, children: string): boolean {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n\n return (\n parent !== children &&\n pathsA.every((value, index) => value === pathsB[index])\n );\n}\n\nexport class FilesystemWeb extends WebPlugin implements FilesystemPlugin {\n DB_VERSION = 1;\n DB_NAME = 'Disc';\n\n private _writeCmds: string[] = ['add', 'put', 'delete'];\n private _db?: IDBDatabase;\n static _debug = true;\n async initDb(): Promise<IDBDatabase> {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n\n return new Promise<IDBDatabase>((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n\n static doUpgrade(event: IDBVersionChangeEvent): void {\n const eventTarget = event.target as IDBOpenDBRequest;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n\n async dbRequest(cmd: string, args: any[]): Promise<any> {\n const readFlag =\n this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn: IDBDatabase) => {\n return new Promise<IDBObjectStore>((resolve, reject) => {\n const tx: IDBTransaction = conn.transaction(['FileStorage'], readFlag);\n const store: any = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n\n async dbIndexRequest(\n indexName: string,\n cmd: string,\n args: [any],\n ): Promise<any> {\n const readFlag =\n this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn: IDBDatabase) => {\n return new Promise<IDBObjectStore>((resolve, reject) => {\n const tx: IDBTransaction = conn.transaction(['FileStorage'], readFlag);\n const store: IDBObjectStore = tx.objectStore('FileStorage');\n const index: any = store.index(indexName);\n const req = index[cmd](...args) as any;\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n\n private getPath(\n directory: Directory | undefined,\n uriPath: string | undefined,\n ): string {\n const cleanedUriPath =\n uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined) fsPath += '/' + directory;\n if (uriPath !== '') fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n\n async clear(): Promise<void> {\n const conn: IDBDatabase = await this.initDb();\n const tx: IDBTransaction = conn.transaction(['FileStorage'], 'readwrite');\n const store: IDBObjectStore = tx.objectStore('FileStorage');\n store.clear();\n }\n\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options: ReadFileOptions): Promise<ReadFileResult> {\n const path: string = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n\n const entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options: WriteFileOptions): Promise<WriteFileResult> {\n const path: string = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n\n const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n\n const parentEntry = (await this.dbRequest('get', [parentPath])) as EntryObj;\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n\n if (!encoding) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n\n const now = Date.now();\n const pathObj: EntryObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options: AppendFileOptions): Promise<void> {\n const path: string = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n\n const now = Date.now();\n let ctime = now;\n\n const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n\n const parentEntry = (await this.dbRequest('get', [parentPath])) as EntryObj;\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n } else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj: EntryObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options: DeleteFileOptions): Promise<void> {\n const path: string = this.getPath(options.directory, options.path);\n\n const entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0) throw Error('Folder is not empty.');\n\n await this.dbRequest('delete', [path]);\n }\n\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options: MkdirOptions): Promise<void> {\n const path: string = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath])) as EntryObj;\n const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;\n if (depth === 1) throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj: EntryObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options: RmdirOptions): Promise<void> {\n const { path, directory, recursive } = options;\n const fullPath: string = this.getPath(directory, path);\n\n const entry = (await this.dbRequest('get', [fullPath])) as EntryObj;\n\n if (entry === undefined) throw Error('Folder does not exist.');\n\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n\n const readDirResult = await this.readdir({ path, directory });\n\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n } else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n\n await this.dbRequest('delete', [fullPath]);\n }\n\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options: ReaddirOptions): Promise<ReaddirResult> {\n const path: string = this.getPath(options.directory, options.path);\n\n const entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n\n const entries: string[] = await this.dbIndexRequest(\n 'by_folder',\n 'getAllKeys',\n [IDBKeyRange.only(path)],\n );\n const files = await Promise.all(\n entries.map(async e => {\n let subEntry = (await this.dbRequest('get', [e])) as EntryObj;\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/'])) as EntryObj;\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }),\n );\n return { files: files };\n }\n\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options: GetUriOptions): Promise<GetUriResult> {\n const path: string = this.getPath(options.directory, options.path);\n\n let entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/'])) as EntryObj;\n }\n return {\n uri: entry?.path || path,\n };\n }\n\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options: StatOptions): Promise<StatResult> {\n const path: string = this.getPath(options.directory, options.path);\n\n let entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/'])) as EntryObj;\n }\n if (entry === undefined) throw Error('Entry does not exist.');\n\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options: RenameOptions): Promise<void> {\n await this._copy(options, true);\n return;\n }\n\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options: CopyOptions): Promise<CopyResult> {\n return this._copy(options, false);\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n return { publicStorage: 'granted' };\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n return { publicStorage: 'granted' };\n }\n\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n private async _copy(\n options: CopyOptions,\n doRename = false,\n ): Promise<CopyResult> {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n } catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path: string, ctime: number, mtime: number) => {\n const fullPath: string = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath])) as EntryObj;\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n\n let encoding;\n if (!this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n } catch (e) {\n // ignore\n }\n\n // Iterate over the contents of the from location\n const contents = (\n await this.readdir({\n path: from,\n directory: fromDirectory,\n })\n ).files;\n\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy(\n {\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n },\n doRename,\n );\n }\n\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n public downloadFile = async (\n options: DownloadFileOptions,\n ): Promise<DownloadFileResult> => {\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob: Blob;\n\n if (!options?.progress) blob = await response.blob();\n else if (!response?.body) blob = new Blob();\n else {\n const reader = response.body.getReader();\n\n let bytes = 0;\n const chunks: (Uint8Array | undefined)[] = [];\n\n const contentType: string | null = response.headers.get('content-type');\n const contentLength: number = parseInt(\n response.headers.get('content-length') || '0',\n 10,\n );\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) break;\n\n chunks.push(value);\n bytes += value?.length || 0;\n\n const status: ProgressStatus = {\n url: options.url,\n bytes,\n contentLength,\n };\n\n this.notifyListeners('progress', status);\n }\n\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined') continue;\n\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n\n const blobUrl = URL.createObjectURL(blob);\n const tempAnchor = document.createElement('a');\n document.body.appendChild(tempAnchor);\n\n tempAnchor.href = blobUrl;\n tempAnchor.download = options.path; // This should be a filename, not a path\n tempAnchor.click();\n\n URL.revokeObjectURL(blobUrl);\n document.body.removeChild(tempAnchor);\n\n return { path: options.path, blob };\n };\n\n private isBase64String(str: string): boolean {\n try {\n return btoa(atob(str)) == str;\n } catch (err) {\n return false;\n }\n }\n}\n\ninterface EntryObj {\n path: string;\n folder: string;\n type: 'directory' | 'file';\n size: number;\n ctime: number;\n mtime: number;\n uri?: string;\n content?: string;\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA2B9D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,IACE,IAAI,KAAK,IAAI;YACb,QAAQ,CAAC,MAAM,GAAG,CAAC;YACnB,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EACtC;YACA,QAAQ,CAAC,GAAG,EAAE,CAAC;SAChB;aAAM;YACL,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AACD,SAAS,YAAY,CAAC,MAAc,EAAE,QAAgB;IACpD,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC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;qBAC5C;iBACF;gBAAC,OAAO,CAAC,EAAE;oBACV,SAAS;iBACV;gBAED,iDAAiD;gBACjD,MAAM,QAAQ,GAAG,CACf,MAAM,IAAI,CAAC,OAAO,CAAC;oBACjB,IAAI,EAAE,IAAI;oBACV,SAAS,EAAE,aAAa;iBACzB,CAAC,CACH,CAAC,KAAK,CAAC;gBAER,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE;oBAC/B,wDAAwD;oBACxD,MAAM,IAAI,CAAC,KAAK,CACd;wBACE,IAAI,EAAE,GAAG,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE;wBAChC,EAAE,EAAE,GAAG,EAAE,IAAI,QAAQ,CAAC,IAAI,EAAE;wBAC5B,SAAS,EAAE,aAAa;wBACxB,WAAW;qBACZ,EACD,QAAQ,CACT,CAAC;iBACH;gBAED,gDAAgD;gBAChD,IAAI,QAAQ,EAAE;oBACZ,MAAM,IAAI,CAAC,KAAK,CAAC;wBACf,IAAI,EAAE,IAAI;wBACV,SAAS,EAAE,aAAa;qBACzB,CAAC,CAAC;iBACJ;aACF;SACF;QACD,OAAO;YACL,GAAG,EAAE,MAAM;SACZ,CAAC;IACJ,CAAC;IAoEO,cAAc,CAAC,GAAW;QAChC,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC;SAC/B;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,KAAK,CAAC;SACd;IACH,CAAC;;AAppBM,oBAAM,GAAG,IAAI,CAAC","sourcesContent":["import { WebPlugin, buildRequestInit } from '@capacitor/core';\n\nimport type {\n AppendFileOptions,\n CopyOptions,\n CopyResult,\n DeleteFileOptions,\n FilesystemPlugin,\n GetUriOptions,\n GetUriResult,\n MkdirOptions,\n PermissionStatus,\n ReadFileOptions,\n ReadFileResult,\n ReaddirOptions,\n ReaddirResult,\n RenameOptions,\n RmdirOptions,\n StatOptions,\n StatResult,\n WriteFileOptions,\n WriteFileResult,\n Directory,\n DownloadFileOptions,\n DownloadFileResult,\n ProgressStatus,\n} from './definitions';\nimport { Encoding } from './definitions';\n\nfunction resolve(path: string): string {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix: string[] = [];\n\n posix.forEach(item => {\n if (\n item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..'\n ) {\n newPosix.pop();\n } else {\n newPosix.push(item);\n }\n });\n\n return newPosix.join('/');\n}\nfunction isPathParent(parent: string, children: string): boolean {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n\n return (\n parent !== children &&\n pathsA.every((value, index) => value === pathsB[index])\n );\n}\n\nexport class FilesystemWeb extends WebPlugin implements FilesystemPlugin {\n DB_VERSION = 1;\n DB_NAME = 'Disc';\n\n private _writeCmds: string[] = ['add', 'put', 'delete'];\n private _db?: IDBDatabase;\n static _debug = true;\n async initDb(): Promise<IDBDatabase> {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n\n return new Promise<IDBDatabase>((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n\n static doUpgrade(event: IDBVersionChangeEvent): void {\n const eventTarget = event.target as IDBOpenDBRequest;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n\n async dbRequest(cmd: string, args: any[]): Promise<any> {\n const readFlag =\n this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn: IDBDatabase) => {\n return new Promise<IDBObjectStore>((resolve, reject) => {\n const tx: IDBTransaction = conn.transaction(['FileStorage'], readFlag);\n const store: any = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n\n async dbIndexRequest(\n indexName: string,\n cmd: string,\n args: [any],\n ): Promise<any> {\n const readFlag =\n this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn: IDBDatabase) => {\n return new Promise<IDBObjectStore>((resolve, reject) => {\n const tx: IDBTransaction = conn.transaction(['FileStorage'], readFlag);\n const store: IDBObjectStore = tx.objectStore('FileStorage');\n const index: any = store.index(indexName);\n const req = index[cmd](...args) as any;\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n\n private getPath(\n directory: Directory | undefined,\n uriPath: string | undefined,\n ): string {\n const cleanedUriPath =\n uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined) fsPath += '/' + directory;\n if (uriPath !== '') fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n\n async clear(): Promise<void> {\n const conn: IDBDatabase = await this.initDb();\n const tx: IDBTransaction = conn.transaction(['FileStorage'], 'readwrite');\n const store: IDBObjectStore = tx.objectStore('FileStorage');\n store.clear();\n }\n\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options: ReadFileOptions): Promise<ReadFileResult> {\n const path: string = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n\n const entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options: WriteFileOptions): Promise<WriteFileResult> {\n const path: string = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n\n const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n\n const parentEntry = (await this.dbRequest('get', [parentPath])) as EntryObj;\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n\n if (!encoding && !(data instanceof Blob)) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n\n const now = Date.now();\n const pathObj: EntryObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data instanceof Blob ? data.size : data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options: AppendFileOptions): Promise<void> {\n const path: string = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n\n const now = Date.now();\n let ctime = now;\n\n const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n\n const parentEntry = (await this.dbRequest('get', [parentPath])) as EntryObj;\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content instanceof Blob) {\n throw Error(\n 'The occupied entry contains a Blob object which cannot be appended to.',\n );\n }\n\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n } else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj: EntryObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options: DeleteFileOptions): Promise<void> {\n const path: string = this.getPath(options.directory, options.path);\n\n const entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0) throw Error('Folder is not empty.');\n\n await this.dbRequest('delete', [path]);\n }\n\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options: MkdirOptions): Promise<void> {\n const path: string = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath])) as EntryObj;\n const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;\n if (depth === 1) throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj: EntryObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options: RmdirOptions): Promise<void> {\n const { path, directory, recursive } = options;\n const fullPath: string = this.getPath(directory, path);\n\n const entry = (await this.dbRequest('get', [fullPath])) as EntryObj;\n\n if (entry === undefined) throw Error('Folder does not exist.');\n\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n\n const readDirResult = await this.readdir({ path, directory });\n\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n } else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n\n await this.dbRequest('delete', [fullPath]);\n }\n\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options: ReaddirOptions): Promise<ReaddirResult> {\n const path: string = this.getPath(options.directory, options.path);\n\n const entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n\n const entries: string[] = await this.dbIndexRequest(\n 'by_folder',\n 'getAllKeys',\n [IDBKeyRange.only(path)],\n );\n const files = await Promise.all(\n entries.map(async e => {\n let subEntry = (await this.dbRequest('get', [e])) as EntryObj;\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/'])) as EntryObj;\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }),\n );\n return { files: files };\n }\n\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options: GetUriOptions): Promise<GetUriResult> {\n const path: string = this.getPath(options.directory, options.path);\n\n let entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/'])) as EntryObj;\n }\n return {\n uri: entry?.path || path,\n };\n }\n\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options: StatOptions): Promise<StatResult> {\n const path: string = this.getPath(options.directory, options.path);\n\n let entry = (await this.dbRequest('get', [path])) as EntryObj;\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/'])) as EntryObj;\n }\n if (entry === undefined) throw Error('Entry does not exist.');\n\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options: RenameOptions): Promise<void> {\n await this._copy(options, true);\n return;\n }\n\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options: CopyOptions): Promise<CopyResult> {\n return this._copy(options, false);\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n return { publicStorage: 'granted' };\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n return { publicStorage: 'granted' };\n }\n\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n private async _copy(\n options: CopyOptions,\n doRename = false,\n ): Promise<CopyResult> {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n } catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path: string, ctime: number, mtime: number) => {\n const fullPath: string = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath])) as EntryObj;\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n\n let encoding;\n if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n } catch (e) {\n // ignore\n }\n\n // Iterate over the contents of the from location\n const contents = (\n await this.readdir({\n path: from,\n directory: fromDirectory,\n })\n ).files;\n\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy(\n {\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n },\n doRename,\n );\n }\n\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n public downloadFile = async (\n options: DownloadFileOptions,\n ): Promise<DownloadFileResult> => {\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob: Blob;\n\n if (!options.progress) blob = await response.blob();\n else if (!response?.body) blob = new Blob();\n else {\n const reader = response.body.getReader();\n\n let bytes = 0;\n const chunks: (Uint8Array | undefined)[] = [];\n\n const contentType: string | null = response.headers.get('content-type');\n const contentLength: number = parseInt(\n response.headers.get('content-length') || '0',\n 10,\n );\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) break;\n\n chunks.push(value);\n bytes += value?.length || 0;\n\n const status: ProgressStatus = {\n url: options.url,\n bytes,\n contentLength,\n };\n\n this.notifyListeners('progress', status);\n }\n\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined') continue;\n\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n\n const result = await this.writeFile({\n path: options.path,\n directory: options.directory ?? undefined,\n recursive: options.recursive ?? false,\n data: blob,\n });\n\n return { path: result.uri, blob };\n };\n\n private isBase64String(str: string): boolean {\n try {\n return btoa(atob(str)) == str;\n } catch (err) {\n return false;\n }\n }\n}\n\ninterface EntryObj {\n path: string;\n folder: string;\n type: 'directory' | 'file';\n size: number;\n ctime: number;\n mtime: number;\n uri?: string;\n content?: string | Blob;\n}\n"]}
@@ -146,10 +146,11 @@ class FilesystemWeb extends core.WebPlugin {
146
146
  * @returns a promise that resolves with the download file result
147
147
  */
148
148
  this.downloadFile = async (options) => {
149
+ var _a, _b;
149
150
  const requestInit = core.buildRequestInit(options, options.webFetchExtra);
150
151
  const response = await fetch(options.url, requestInit);
151
152
  let blob;
152
- if (!(options === null || options === void 0 ? void 0 : options.progress))
153
+ if (!options.progress)
153
154
  blob = await response.blob();
154
155
  else if (!(response === null || response === void 0 ? void 0 : response.body))
155
156
  blob = new Blob();
@@ -182,15 +183,13 @@ class FilesystemWeb extends core.WebPlugin {
182
183
  }
183
184
  blob = new Blob([allChunks.buffer], { type: contentType || undefined });
184
185
  }
185
- const blobUrl = URL.createObjectURL(blob);
186
- const tempAnchor = document.createElement('a');
187
- document.body.appendChild(tempAnchor);
188
- tempAnchor.href = blobUrl;
189
- tempAnchor.download = options.path; // This should be a filename, not a path
190
- tempAnchor.click();
191
- URL.revokeObjectURL(blobUrl);
192
- document.body.removeChild(tempAnchor);
193
- return { path: options.path, blob };
186
+ const result = await this.writeFile({
187
+ path: options.path,
188
+ directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,
189
+ recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,
190
+ data: blob,
191
+ });
192
+ return { path: result.uri, blob };
194
193
  };
195
194
  }
196
195
  async initDb() {
@@ -307,7 +306,7 @@ class FilesystemWeb extends core.WebPlugin {
307
306
  });
308
307
  }
309
308
  }
310
- if (!encoding) {
309
+ if (!encoding && !(data instanceof Blob)) {
311
310
  data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;
312
311
  if (!this.isBase64String(data))
313
312
  throw Error('The supplied data is not valid base64 content.');
@@ -317,7 +316,7 @@ class FilesystemWeb extends core.WebPlugin {
317
316
  path: path,
318
317
  folder: parentPath,
319
318
  type: 'file',
320
- size: data.length,
319
+ size: data instanceof Blob ? data.size : data.length,
321
320
  ctime: now,
322
321
  mtime: now,
323
322
  content: data,
@@ -357,6 +356,9 @@ class FilesystemWeb extends core.WebPlugin {
357
356
  if (!encoding && !this.isBase64String(data))
358
357
  throw Error('The supplied data is not valid base64 content.');
359
358
  if (occupiedEntry !== undefined) {
359
+ if (occupiedEntry.content instanceof Blob) {
360
+ throw Error('The occupied entry contains a Blob object which cannot be appended to.');
361
+ }
360
362
  if (occupiedEntry.content !== undefined && !encoding) {
361
363
  data = btoa(atob(occupiedEntry.content) + atob(data));
362
364
  }
@@ -628,7 +630,7 @@ class FilesystemWeb extends core.WebPlugin {
628
630
  });
629
631
  }
630
632
  let encoding;
631
- if (!this.isBase64String(file.data)) {
633
+ if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {
632
634
  encoding = exports.Encoding.UTF8;
633
635
  }
634
636
  // Write the file to the new location
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Directory;\n(function (Directory) {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Directory[\"Documents\"] = \"DOCUMENTS\";\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"Data\"] = \"DATA\";\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Directory[\"Library\"] = \"LIBRARY\";\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Directory[\"Cache\"] = \"CACHE\";\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"External\"] = \"EXTERNAL\";\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\n})(Directory || (Directory = {}));\nexport var Encoding;\n(function (Encoding) {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n Encoding[\"UTF8\"] = \"utf8\";\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"ASCII\"] = \"ascii\";\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"UTF16\"] = \"utf16\";\n})(Encoding || (Encoding = {}));\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Filesystem = registerPlugin('Filesystem', {\n web: () => import('./web').then(m => new m.FilesystemWeb()),\n});\nexport * from './definitions';\nexport { Filesystem };\n//# sourceMappingURL=index.js.map","import { WebPlugin, buildRequestInit } from '@capacitor/core';\nimport { Encoding } from './definitions';\nfunction resolve(path) {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix = [];\n posix.forEach(item => {\n if (item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n }\n else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return (parent !== children &&\n pathsA.every((value, index) => value === pathsB[index]));\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n this.downloadFile = async (options) => {\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob;\n if (!(options === null || options === void 0 ? void 0 : options.progress))\n blob = await response.blob();\n else if (!(response === null || response === void 0 ? void 0 : response.body))\n blob = new Blob();\n else {\n const reader = response.body.getReader();\n let bytes = 0;\n const chunks = [];\n const contentType = response.headers.get('content-type');\n const contentLength = parseInt(response.headers.get('content-length') || '0', 10);\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n chunks.push(value);\n bytes += (value === null || value === void 0 ? void 0 : value.length) || 0;\n const status = {\n url: options.url,\n bytes,\n contentLength,\n };\n this.notifyListeners('progress', status);\n }\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined')\n continue;\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n const blobUrl = URL.createObjectURL(blob);\n const tempAnchor = document.createElement('a');\n document.body.appendChild(tempAnchor);\n tempAnchor.href = blobUrl;\n tempAnchor.download = options.path; // This should be a filename, not a path\n tempAnchor.click();\n URL.revokeObjectURL(blobUrl);\n document.body.removeChild(tempAnchor);\n return { path: options.path, blob };\n };\n }\n async initDb() {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n async dbRequest(cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n async dbIndexRequest(indexName, cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined)\n fsPath += '/' + directory;\n if (uriPath !== '')\n fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n async clear() {\n const conn = await this.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options) {\n const path = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n if (!encoding) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n }\n else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0)\n throw Error('Folder is not empty.');\n await this.dbRequest('delete', [path]);\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options) {\n const path = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (depth === 1)\n throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options) {\n const { path, directory, recursive } = options;\n const fullPath = this.getPath(directory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n if (entry === undefined)\n throw Error('Folder does not exist.');\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n const readDirResult = await this.readdir({ path, directory });\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n }\n else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n await this.dbRequest('delete', [fullPath]);\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = await Promise.all(entries.map(async (e) => {\n let subEntry = (await this.dbRequest('get', [e]));\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/']));\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }));\n return { files: files };\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path,\n };\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n if (entry === undefined)\n throw Error('Entry does not exist.');\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options) {\n await this._copy(options, true);\n return;\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options) {\n return this._copy(options, false);\n }\n async requestPermissions() {\n return { publicStorage: 'granted' };\n }\n async checkPermissions() {\n return { publicStorage: 'granted' };\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n async _copy(options, doRename = false) {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n }\n catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path, ctime, mtime) => {\n const fullPath = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n let encoding;\n if (!this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n }\n catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (await this.readdir({\n path: from,\n directory: fromDirectory,\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy({\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n }\n catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;\n//# sourceMappingURL=web.js.map"],"names":["Directory","Encoding","registerPlugin","WebPlugin","buildRequestInit"],"mappings":";;;;;;AAAWA,2BAAU;AACrB,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,kBAAkB,CAAC;AACtD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC,CAAC;AACvBC,0BAAS;AACpB,CAAC,UAAU,QAAQ,EAAE;AACrB;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAC9B;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,IAAI;AACZ,YAAY,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC;AAC1C,SAAS;AACT,QAAQ,OAAO,GAAG,EAAE;AACpB,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,KAAK;AACL,CAAC;AACD,aAAa,CAAC,MAAM,GAAG,IAAI;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Directory;\n(function (Directory) {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Directory[\"Documents\"] = \"DOCUMENTS\";\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"Data\"] = \"DATA\";\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Directory[\"Library\"] = \"LIBRARY\";\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Directory[\"Cache\"] = \"CACHE\";\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"External\"] = \"EXTERNAL\";\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\n})(Directory || (Directory = {}));\nexport var Encoding;\n(function (Encoding) {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n Encoding[\"UTF8\"] = \"utf8\";\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"ASCII\"] = \"ascii\";\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"UTF16\"] = \"utf16\";\n})(Encoding || (Encoding = {}));\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Filesystem = registerPlugin('Filesystem', {\n web: () => import('./web').then(m => new m.FilesystemWeb()),\n});\nexport * from './definitions';\nexport { Filesystem };\n//# sourceMappingURL=index.js.map","import { WebPlugin, buildRequestInit } from '@capacitor/core';\nimport { Encoding } from './definitions';\nfunction resolve(path) {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix = [];\n posix.forEach(item => {\n if (item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n }\n else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return (parent !== children &&\n pathsA.every((value, index) => value === pathsB[index]));\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n this.downloadFile = async (options) => {\n var _a, _b;\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob;\n if (!options.progress)\n blob = await response.blob();\n else if (!(response === null || response === void 0 ? void 0 : response.body))\n blob = new Blob();\n else {\n const reader = response.body.getReader();\n let bytes = 0;\n const chunks = [];\n const contentType = response.headers.get('content-type');\n const contentLength = parseInt(response.headers.get('content-length') || '0', 10);\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n chunks.push(value);\n bytes += (value === null || value === void 0 ? void 0 : value.length) || 0;\n const status = {\n url: options.url,\n bytes,\n contentLength,\n };\n this.notifyListeners('progress', status);\n }\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined')\n continue;\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n const result = await this.writeFile({\n path: options.path,\n directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,\n recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,\n data: blob,\n });\n return { path: result.uri, blob };\n };\n }\n async initDb() {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n async dbRequest(cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n async dbIndexRequest(indexName, cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined)\n fsPath += '/' + directory;\n if (uriPath !== '')\n fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n async clear() {\n const conn = await this.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options) {\n const path = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n if (!encoding && !(data instanceof Blob)) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data instanceof Blob ? data.size : data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content instanceof Blob) {\n throw Error('The occupied entry contains a Blob object which cannot be appended to.');\n }\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n }\n else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0)\n throw Error('Folder is not empty.');\n await this.dbRequest('delete', [path]);\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options) {\n const path = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (depth === 1)\n throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options) {\n const { path, directory, recursive } = options;\n const fullPath = this.getPath(directory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n if (entry === undefined)\n throw Error('Folder does not exist.');\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n const readDirResult = await this.readdir({ path, directory });\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n }\n else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n await this.dbRequest('delete', [fullPath]);\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = await Promise.all(entries.map(async (e) => {\n let subEntry = (await this.dbRequest('get', [e]));\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/']));\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }));\n return { files: files };\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path,\n };\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n if (entry === undefined)\n throw Error('Entry does not exist.');\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options) {\n await this._copy(options, true);\n return;\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options) {\n return this._copy(options, false);\n }\n async requestPermissions() {\n return { publicStorage: 'granted' };\n }\n async checkPermissions() {\n return { publicStorage: 'granted' };\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n async _copy(options, doRename = false) {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n }\n catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path, ctime, mtime) => {\n const fullPath = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n let encoding;\n if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n }\n catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (await this.readdir({\n path: from,\n directory: fromDirectory,\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy({\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n }\n catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;\n//# sourceMappingURL=web.js.map"],"names":["Directory","Encoding","registerPlugin","WebPlugin","buildRequestInit"],"mappings":";;;;;;AAAWA,2BAAU;AACrB,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,kBAAkB,CAAC;AACtD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC,CAAC;AACvBC,0BAAS;AACpB,CAAC,UAAU,QAAQ,EAAE;AACrB;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAChC,CAAC,EAAEA,gBAAQ,KAAKA,gBAAQ,GAAG,EAAE,CAAC,CAAC,CAAC;AAChC;AACA;AACA;AACA;AACY,MAAC,mBAAmB,GAAGD,kBAAU;AAC7C;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAGC;;ACnG7B,M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AM,GAAG,IAAI;;;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -143,10 +143,11 @@ var capacitorFilesystem = (function (exports, core) {
143
143
  * @returns a promise that resolves with the download file result
144
144
  */
145
145
  this.downloadFile = async (options) => {
146
+ var _a, _b;
146
147
  const requestInit = core.buildRequestInit(options, options.webFetchExtra);
147
148
  const response = await fetch(options.url, requestInit);
148
149
  let blob;
149
- if (!(options === null || options === void 0 ? void 0 : options.progress))
150
+ if (!options.progress)
150
151
  blob = await response.blob();
151
152
  else if (!(response === null || response === void 0 ? void 0 : response.body))
152
153
  blob = new Blob();
@@ -179,15 +180,13 @@ var capacitorFilesystem = (function (exports, core) {
179
180
  }
180
181
  blob = new Blob([allChunks.buffer], { type: contentType || undefined });
181
182
  }
182
- const blobUrl = URL.createObjectURL(blob);
183
- const tempAnchor = document.createElement('a');
184
- document.body.appendChild(tempAnchor);
185
- tempAnchor.href = blobUrl;
186
- tempAnchor.download = options.path; // This should be a filename, not a path
187
- tempAnchor.click();
188
- URL.revokeObjectURL(blobUrl);
189
- document.body.removeChild(tempAnchor);
190
- return { path: options.path, blob };
183
+ const result = await this.writeFile({
184
+ path: options.path,
185
+ directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,
186
+ recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,
187
+ data: blob,
188
+ });
189
+ return { path: result.uri, blob };
191
190
  };
192
191
  }
193
192
  async initDb() {
@@ -304,7 +303,7 @@ var capacitorFilesystem = (function (exports, core) {
304
303
  });
305
304
  }
306
305
  }
307
- if (!encoding) {
306
+ if (!encoding && !(data instanceof Blob)) {
308
307
  data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;
309
308
  if (!this.isBase64String(data))
310
309
  throw Error('The supplied data is not valid base64 content.');
@@ -314,7 +313,7 @@ var capacitorFilesystem = (function (exports, core) {
314
313
  path: path,
315
314
  folder: parentPath,
316
315
  type: 'file',
317
- size: data.length,
316
+ size: data instanceof Blob ? data.size : data.length,
318
317
  ctime: now,
319
318
  mtime: now,
320
319
  content: data,
@@ -354,6 +353,9 @@ var capacitorFilesystem = (function (exports, core) {
354
353
  if (!encoding && !this.isBase64String(data))
355
354
  throw Error('The supplied data is not valid base64 content.');
356
355
  if (occupiedEntry !== undefined) {
356
+ if (occupiedEntry.content instanceof Blob) {
357
+ throw Error('The occupied entry contains a Blob object which cannot be appended to.');
358
+ }
357
359
  if (occupiedEntry.content !== undefined && !encoding) {
358
360
  data = btoa(atob(occupiedEntry.content) + atob(data));
359
361
  }
@@ -625,7 +627,7 @@ var capacitorFilesystem = (function (exports, core) {
625
627
  });
626
628
  }
627
629
  let encoding;
628
- if (!this.isBase64String(file.data)) {
630
+ if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {
629
631
  encoding = exports.Encoding.UTF8;
630
632
  }
631
633
  // Write the file to the new location
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Directory;\n(function (Directory) {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Directory[\"Documents\"] = \"DOCUMENTS\";\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"Data\"] = \"DATA\";\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Directory[\"Library\"] = \"LIBRARY\";\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Directory[\"Cache\"] = \"CACHE\";\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"External\"] = \"EXTERNAL\";\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\n})(Directory || (Directory = {}));\nexport var Encoding;\n(function (Encoding) {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n Encoding[\"UTF8\"] = \"utf8\";\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"ASCII\"] = \"ascii\";\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"UTF16\"] = \"utf16\";\n})(Encoding || (Encoding = {}));\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Filesystem = registerPlugin('Filesystem', {\n web: () => import('./web').then(m => new m.FilesystemWeb()),\n});\nexport * from './definitions';\nexport { Filesystem };\n//# sourceMappingURL=index.js.map","import { WebPlugin, buildRequestInit } from '@capacitor/core';\nimport { Encoding } from './definitions';\nfunction resolve(path) {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix = [];\n posix.forEach(item => {\n if (item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n }\n else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return (parent !== children &&\n pathsA.every((value, index) => value === pathsB[index]));\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n this.downloadFile = async (options) => {\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob;\n if (!(options === null || options === void 0 ? void 0 : options.progress))\n blob = await response.blob();\n else if (!(response === null || response === void 0 ? void 0 : response.body))\n blob = new Blob();\n else {\n const reader = response.body.getReader();\n let bytes = 0;\n const chunks = [];\n const contentType = response.headers.get('content-type');\n const contentLength = parseInt(response.headers.get('content-length') || '0', 10);\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n chunks.push(value);\n bytes += (value === null || value === void 0 ? void 0 : value.length) || 0;\n const status = {\n url: options.url,\n bytes,\n contentLength,\n };\n this.notifyListeners('progress', status);\n }\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined')\n continue;\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n const blobUrl = URL.createObjectURL(blob);\n const tempAnchor = document.createElement('a');\n document.body.appendChild(tempAnchor);\n tempAnchor.href = blobUrl;\n tempAnchor.download = options.path; // This should be a filename, not a path\n tempAnchor.click();\n URL.revokeObjectURL(blobUrl);\n document.body.removeChild(tempAnchor);\n return { path: options.path, blob };\n };\n }\n async initDb() {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n async dbRequest(cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n async dbIndexRequest(indexName, cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined)\n fsPath += '/' + directory;\n if (uriPath !== '')\n fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n async clear() {\n const conn = await this.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options) {\n const path = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n if (!encoding) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n }\n else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0)\n throw Error('Folder is not empty.');\n await this.dbRequest('delete', [path]);\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options) {\n const path = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (depth === 1)\n throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options) {\n const { path, directory, recursive } = options;\n const fullPath = this.getPath(directory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n if (entry === undefined)\n throw Error('Folder does not exist.');\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n const readDirResult = await this.readdir({ path, directory });\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n }\n else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n await this.dbRequest('delete', [fullPath]);\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = await Promise.all(entries.map(async (e) => {\n let subEntry = (await this.dbRequest('get', [e]));\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/']));\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }));\n return { files: files };\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path,\n };\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n if (entry === undefined)\n throw Error('Entry does not exist.');\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options) {\n await this._copy(options, true);\n return;\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options) {\n return this._copy(options, false);\n }\n async requestPermissions() {\n return { publicStorage: 'granted' };\n }\n async checkPermissions() {\n return { publicStorage: 'granted' };\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n async _copy(options, doRename = false) {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n }\n catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path, ctime, mtime) => {\n const fullPath = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n let encoding;\n if (!this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n }\n catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (await this.readdir({\n path: from,\n directory: fromDirectory,\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy({\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n }\n catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;\n//# sourceMappingURL=web.js.map"],"names":["Directory","Encoding","registerPlugin","WebPlugin","buildRequestInit"],"mappings":";;;AAAWA,+BAAU;IACrB,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;IACzC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC/B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACrC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACjC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,kBAAkB,CAAC;IACtD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC,CAAC;AACvBC,8BAAS;IACpB,CAAC,UAAU,QAAQ,EAAE;IACrB;IACA;IACA;IACA;IACA;IACA,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC9B;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAChC;IACA;IACA;IACA;IACA;IACA;IACA;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GAAG,EAAE;IACpB,YAAY,OAAO,KAAK,CAAC;IACzB,SAAS;IACT,KAAK;IACL,CAAC;IACD,aAAa,CAAC,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Directory;\n(function (Directory) {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Directory[\"Documents\"] = \"DOCUMENTS\";\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"Data\"] = \"DATA\";\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Directory[\"Library\"] = \"LIBRARY\";\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Directory[\"Cache\"] = \"CACHE\";\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"External\"] = \"EXTERNAL\";\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\n})(Directory || (Directory = {}));\nexport var Encoding;\n(function (Encoding) {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n Encoding[\"UTF8\"] = \"utf8\";\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"ASCII\"] = \"ascii\";\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"UTF16\"] = \"utf16\";\n})(Encoding || (Encoding = {}));\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Filesystem = registerPlugin('Filesystem', {\n web: () => import('./web').then(m => new m.FilesystemWeb()),\n});\nexport * from './definitions';\nexport { Filesystem };\n//# sourceMappingURL=index.js.map","import { WebPlugin, buildRequestInit } from '@capacitor/core';\nimport { Encoding } from './definitions';\nfunction resolve(path) {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix = [];\n posix.forEach(item => {\n if (item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n }\n else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return (parent !== children &&\n pathsA.every((value, index) => value === pathsB[index]));\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n this.downloadFile = async (options) => {\n var _a, _b;\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob;\n if (!options.progress)\n blob = await response.blob();\n else if (!(response === null || response === void 0 ? void 0 : response.body))\n blob = new Blob();\n else {\n const reader = response.body.getReader();\n let bytes = 0;\n const chunks = [];\n const contentType = response.headers.get('content-type');\n const contentLength = parseInt(response.headers.get('content-length') || '0', 10);\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n chunks.push(value);\n bytes += (value === null || value === void 0 ? void 0 : value.length) || 0;\n const status = {\n url: options.url,\n bytes,\n contentLength,\n };\n this.notifyListeners('progress', status);\n }\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined')\n continue;\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n const result = await this.writeFile({\n path: options.path,\n directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,\n recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,\n data: blob,\n });\n return { path: result.uri, blob };\n };\n }\n async initDb() {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n async dbRequest(cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n async dbIndexRequest(indexName, cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined)\n fsPath += '/' + directory;\n if (uriPath !== '')\n fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n async clear() {\n const conn = await this.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options) {\n const path = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n if (!encoding && !(data instanceof Blob)) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data instanceof Blob ? data.size : data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content instanceof Blob) {\n throw Error('The occupied entry contains a Blob object which cannot be appended to.');\n }\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n }\n else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0)\n throw Error('Folder is not empty.');\n await this.dbRequest('delete', [path]);\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options) {\n const path = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (depth === 1)\n throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options) {\n const { path, directory, recursive } = options;\n const fullPath = this.getPath(directory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n if (entry === undefined)\n throw Error('Folder does not exist.');\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n const readDirResult = await this.readdir({ path, directory });\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n }\n else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n await this.dbRequest('delete', [fullPath]);\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = await Promise.all(entries.map(async (e) => {\n let subEntry = (await this.dbRequest('get', [e]));\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/']));\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }));\n return { files: files };\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path,\n };\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n if (entry === undefined)\n throw Error('Entry does not exist.');\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options) {\n await this._copy(options, true);\n return;\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options) {\n return this._copy(options, false);\n }\n async requestPermissions() {\n return { publicStorage: 'granted' };\n }\n async checkPermissions() {\n return { publicStorage: 'granted' };\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n async _copy(options, doRename = false) {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n }\n catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path, ctime, mtime) => {\n const fullPath = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n let encoding;\n if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n }\n catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (await this.readdir({\n path: from,\n directory: fromDirectory,\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy({\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n }\n catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;\n//# sourceMappingURL=web.js.map"],"names":["Directory","Encoding","registerPlugin","WebPlugin","buildRequestInit"],"mappings":";;;AAAWA,+BAAU;IACrB,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAC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.1.2-nightly-20230809T150556.0",
3
+ "version": "5.1.3-nightly-20230810T150553.0",
4
4
  "description": "The Filesystem API provides a NodeJS-like API for working with files on the device.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",