@capacitor/filesystem 7.0.2-nightly-20250526T150552.0 → 7.1.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CapacitorFilesystem.podspec +4 -3
  2. package/Package.swift +10 -4
  3. package/README.md +149 -78
  4. package/android/build.gradle +12 -22
  5. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemErrors.kt +101 -0
  6. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodOptions.kt +129 -0
  7. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodResults.kt +65 -0
  8. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemPlugin.kt +412 -0
  9. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/LegacyFilesystemImplementation.kt +169 -0
  10. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/PluginResultExtensions.kt +25 -0
  11. package/dist/docs.json +227 -145
  12. package/dist/esm/definitions.d.ts +102 -64
  13. package/dist/esm/definitions.js +25 -3
  14. package/dist/esm/definitions.js.map +1 -1
  15. package/dist/esm/index.js +3 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/web.d.ts +3 -1
  18. package/dist/esm/web.js +10 -10
  19. package/dist/esm/web.js.map +1 -1
  20. package/dist/plugin.cjs.js +40 -14
  21. package/dist/plugin.cjs.js.map +1 -1
  22. package/dist/plugin.js +41 -16
  23. package/dist/plugin.js.map +1 -1
  24. package/ios/Sources/FilesystemPlugin/CAPPluginCall+Accelerators.swift +73 -0
  25. package/ios/Sources/FilesystemPlugin/FilesystemConstants.swift +61 -0
  26. package/ios/Sources/FilesystemPlugin/FilesystemError.swift +57 -0
  27. package/ios/Sources/FilesystemPlugin/FilesystemLocationResolver.swift +39 -0
  28. package/ios/Sources/FilesystemPlugin/FilesystemOperation.swift +24 -0
  29. package/ios/Sources/FilesystemPlugin/FilesystemOperationExecutor.swift +116 -0
  30. package/ios/Sources/FilesystemPlugin/FilesystemPlugin.swift +103 -264
  31. package/ios/Sources/FilesystemPlugin/IONFileStructures+Converters.swift +60 -0
  32. package/ios/Sources/FilesystemPlugin/{Filesystem.swift → LegacyFilesystemImplementation.swift} +18 -179
  33. package/package.json +28 -24
  34. package/LICENSE +0 -23
  35. package/android/src/main/java/com/capacitorjs/plugins/filesystem/Filesystem.java +0 -414
  36. package/android/src/main/java/com/capacitorjs/plugins/filesystem/FilesystemPlugin.java +0 -551
  37. package/android/src/main/java/com/capacitorjs/plugins/filesystem/exceptions/CopyFailedException.java +0 -16
  38. package/android/src/main/java/com/capacitorjs/plugins/filesystem/exceptions/DirectoryExistsException.java +0 -16
  39. package/android/src/main/java/com/capacitorjs/plugins/filesystem/exceptions/DirectoryNotFoundException.java +0 -16
@@ -1,4 +1,5 @@
1
1
  import type { HttpOptions, PermissionState, PluginListenerHandle } from '@capacitor/core';
2
+ export type CallbackID = string;
2
3
  export interface PermissionStatus {
3
4
  publicStorage: PermissionState;
4
5
  }
@@ -8,7 +9,7 @@ export declare enum Directory {
8
9
  * On iOS it's the app's documents directory.
9
10
  * Use this directory to store user-generated content.
10
11
  * On Android it's the Public Documents folder, so it's accessible from other apps.
11
- * It's not accesible on Android 10 unless the app enables legacy External Storage
12
+ * It's not accessible on Android 10 unless the app enables legacy External Storage
12
13
  * by adding `android:requestLegacyExternalStorage="true"` in the `application` tag
13
14
  * in the `AndroidManifest.xml`.
14
15
  * On Android 11 or newer the app can only access the files/folders the app created.
@@ -58,14 +59,36 @@ export declare enum Directory {
58
59
  * The external storage directory.
59
60
  * On iOS it will use the Documents directory.
60
61
  * On Android it's the primary shared/external storage directory.
61
- * It's not accesible on Android 10 unless the app enables legacy External Storage
62
+ * It's not accessible on Android 10 unless the app enables legacy External Storage
62
63
  * by adding `android:requestLegacyExternalStorage="true"` in the `application` tag
63
64
  * in the `AndroidManifest.xml`.
64
- * It's not accesible on Android 11 or newer.
65
+ * It's not accessible on Android 11 or newer.
65
66
  *
66
67
  * @since 1.0.0
67
68
  */
68
- ExternalStorage = "EXTERNAL_STORAGE"
69
+ ExternalStorage = "EXTERNAL_STORAGE",
70
+ /**
71
+ * The external cache directory.
72
+ * On iOS it will use the Documents directory.
73
+ * On Android it's the primary shared/external cache.
74
+ *
75
+ * @since 7.1.0
76
+ */
77
+ ExternalCache = "EXTERNAL_CACHE",
78
+ /**
79
+ * The Library directory without cloud backup. Used in iOS.
80
+ * On Android it's the directory holding application files.
81
+ *
82
+ * @since 7.1.0
83
+ */
84
+ LibraryNoCloud = "LIBRARY_NO_CLOUD",
85
+ /**
86
+ * A temporary directory for iOS.
87
+ * On Android it's the directory holding the application cache.
88
+ *
89
+ * @since 7.1.0
90
+ */
91
+ Temporary = "TEMPORARY"
69
92
  }
70
93
  export declare enum Encoding {
71
94
  /**
@@ -181,6 +204,14 @@ export interface ReadFileOptions {
181
204
  */
182
205
  encoding?: Encoding;
183
206
  }
207
+ export interface ReadFileInChunksOptions extends ReadFileOptions {
208
+ /**
209
+ * Size of the chunks in bytes.
210
+ *
211
+ * @since 7.1.0
212
+ */
213
+ chunkSize: number;
214
+ }
184
215
  export interface DeleteFileOptions {
185
216
  /**
186
217
  * The path of the file to delete
@@ -306,7 +337,7 @@ export interface CopyOptions {
306
337
  */
307
338
  toDirectory?: Directory;
308
339
  }
309
- export declare type RenameOptions = CopyOptions;
340
+ export type RenameOptions = CopyOptions;
310
341
  export interface ReadFileResult {
311
342
  /**
312
343
  * The representation of the data contained in the file
@@ -336,6 +367,8 @@ export interface ReaddirResult {
336
367
  export interface FileInfo {
337
368
  /**
338
369
  * Name of the file or directory.
370
+ *
371
+ * @since 7.1.0
339
372
  */
340
373
  name: string;
341
374
  /**
@@ -355,13 +388,13 @@ export interface FileInfo {
355
388
  *
356
389
  * It's not available on Android 7 and older devices.
357
390
  *
358
- * @since 4.0.0
391
+ * @since 7.1.0
359
392
  */
360
393
  ctime?: number;
361
394
  /**
362
395
  * Time of last modification in milliseconds.
363
396
  *
364
- * @since 4.0.0
397
+ * @since 7.1.0
365
398
  */
366
399
  mtime: number;
367
400
  /**
@@ -379,40 +412,7 @@ export interface GetUriResult {
379
412
  */
380
413
  uri: string;
381
414
  }
382
- export interface StatResult {
383
- /**
384
- * Type of the file.
385
- *
386
- * @since 1.0.0
387
- */
388
- type: 'directory' | 'file';
389
- /**
390
- * Size of the file in bytes.
391
- *
392
- * @since 1.0.0
393
- */
394
- size: number;
395
- /**
396
- * Time of creation in milliseconds.
397
- *
398
- * It's not available on Android 7 and older devices.
399
- *
400
- * @since 1.0.0
401
- */
402
- ctime?: number;
403
- /**
404
- * Time of last modification in milliseconds.
405
- *
406
- * @since 1.0.0
407
- */
408
- mtime: number;
409
- /**
410
- * The uri of the file
411
- *
412
- * @since 1.0.0
413
- */
414
- uri: string;
415
- }
415
+ export type StatResult = FileInfo;
416
416
  export interface CopyResult {
417
417
  /**
418
418
  * The uri where the file was copied into
@@ -487,19 +487,50 @@ export interface ProgressStatus {
487
487
  */
488
488
  contentLength: number;
489
489
  }
490
+ /**
491
+ * Callback for receiving chunks read from a file, or error if something went wrong.
492
+ *
493
+ * @since 7.1.0
494
+ */
495
+ export type ReadFileInChunksCallback = (chunkRead: ReadFileResult | null, err?: any) => void;
490
496
  /**
491
497
  * A listener function that receives progress events.
492
498
  *
493
499
  * @since 5.1.0
494
500
  */
495
- export declare type ProgressListener = (progress: ProgressStatus) => void;
501
+ export type ProgressListener = (progress: ProgressStatus) => void;
496
502
  export interface FilesystemPlugin {
503
+ /**
504
+ * Check read/write permissions.
505
+ * Required on Android, only when using `Directory.Documents` or
506
+ * `Directory.ExternalStorage`.
507
+ *
508
+ * @since 1.0.0
509
+ */
510
+ checkPermissions(): Promise<PermissionStatus>;
511
+ /**
512
+ * Request read/write permissions.
513
+ * Required on Android, only when using `Directory.Documents` or
514
+ * `Directory.ExternalStorage`.
515
+ *
516
+ * @since 1.0.0
517
+ */
518
+ requestPermissions(): Promise<PermissionStatus>;
497
519
  /**
498
520
  * Read a file from disk
499
521
  *
500
522
  * @since 1.0.0
501
523
  */
502
524
  readFile(options: ReadFileOptions): Promise<ReadFileResult>;
525
+ /**
526
+ * Read a file from disk, in chunks.
527
+ * Native only (not available in web).
528
+ * Use the callback to receive each read chunk.
529
+ * If empty chunk is returned, it means file has been completely read.
530
+ *
531
+ * @since 7.1.0
532
+ */
533
+ readFileInChunks(options: ReadFileInChunksOptions, callback: ReadFileInChunksCallback): Promise<CallbackID>;
503
534
  /**
504
535
  * Write a file to disk in the specified location on device
505
536
  *
@@ -560,71 +591,78 @@ export interface FilesystemPlugin {
560
591
  * @since 1.0.0
561
592
  */
562
593
  copy(options: CopyOptions): Promise<CopyResult>;
563
- /**
564
- * Check read/write permissions.
565
- * Required on Android, only when using `Directory.Documents` or
566
- * `Directory.ExternalStorage`.
567
- *
568
- * @since 1.0.0
569
- */
570
- checkPermissions(): Promise<PermissionStatus>;
571
- /**
572
- * Request read/write permissions.
573
- * Required on Android, only when using `Directory.Documents` or
574
- * `Directory.ExternalStorage`.
575
- *
576
- * @since 1.0.0
577
- */
578
- requestPermissions(): Promise<PermissionStatus>;
579
594
  /**
580
595
  * Perform a http request to a server and download the file to the specified destination.
581
596
  *
597
+ * This method has been deprecated since version 7.1.0.
598
+ * We recommend using the @capacitor/file-transfer plugin instead, in conjunction with this plugin.
599
+ *
582
600
  * @since 5.1.0
601
+ * @deprecated Use the @capacitor/file-transfer plugin instead.
583
602
  */
584
603
  downloadFile(options: DownloadFileOptions): Promise<DownloadFileResult>;
585
604
  /**
586
605
  * Add a listener to file download progress events.
587
606
  *
607
+ * This method has been deprecated since version 7.1.0.
608
+ * We recommend using the @capacitor/file-transfer plugin instead, in conjunction with this plugin.
609
+ *
588
610
  * @since 5.1.0
611
+ * @deprecated Use the @capacitor/file-transfer plugin instead.
589
612
  */
590
613
  addListener(eventName: 'progress', listenerFunc: ProgressListener): Promise<PluginListenerHandle>;
591
614
  /**
592
615
  * Remove all listeners for this plugin.
593
616
  *
617
+ * This method has been deprecated since version 7.1.0.
618
+ * We recommend using the @capacitor/file-transfer plugin instead, in conjunction with this plugin.
619
+ *
594
620
  * @since 5.2.0
621
+ * @deprecated Use the @capacitor/file-transfer plugin instead.
595
622
  */
596
623
  removeAllListeners(): Promise<void>;
597
624
  }
625
+ /**
626
+ * Structure for errors returned by the plugin.
627
+ *
628
+ * `code` follows "OS-PLUG-FILE-XXXX" format
629
+ *
630
+ * @since 1.0.0
631
+ */
632
+ export type PluginError = {
633
+ code: string;
634
+ message: string;
635
+ };
598
636
  /**
599
637
  * @deprecated Use `ReadFileOptions`.
600
638
  * @since 1.0.0
601
639
  */
602
- export declare type FileReadOptions = ReadFileOptions;
640
+ export type FileReadOptions = ReadFileOptions;
603
641
  /**
604
642
  * @deprecated Use `ReadFileResult`.
605
643
  * @since 1.0.0
606
644
  */
607
- export declare type FileReadResult = ReadFileResult;
645
+ export type FileReadResult = ReadFileResult;
608
646
  /**
609
647
  * @deprecated Use `WriteFileOptions`.
610
648
  * @since 1.0.0
611
649
  */
612
- export declare type FileWriteOptions = WriteFileOptions;
650
+ export type FileWriteOptions = WriteFileOptions;
613
651
  /**
614
652
  * @deprecated Use `WriteFileResult`.
615
653
  * @since 1.0.0
616
654
  */
617
- export declare type FileWriteResult = WriteFileResult;
655
+ export type FileWriteResult = WriteFileResult;
618
656
  /**
619
657
  * @deprecated Use `AppendFileOptions`.
620
658
  * @since 1.0.0
621
659
  */
622
- export declare type FileAppendOptions = AppendFileOptions;
660
+ export type FileAppendOptions = AppendFileOptions;
623
661
  /**
624
662
  * @deprecated Use `DeleteFileOptions`.
625
663
  * @since 1.0.0
626
664
  */
627
- export declare type FileDeleteOptions = DeleteFileOptions;
665
+ export type FileDeleteOptions = DeleteFileOptions;
628
666
  /**
629
667
  * @deprecated Use `Directory`.
630
668
  * @since 1.0.0
@@ -5,7 +5,7 @@ export var Directory;
5
5
  * On iOS it's the app's documents directory.
6
6
  * Use this directory to store user-generated content.
7
7
  * On Android it's the Public Documents folder, so it's accessible from other apps.
8
- * It's not accesible on Android 10 unless the app enables legacy External Storage
8
+ * It's not accessible on Android 10 unless the app enables legacy External Storage
9
9
  * by adding `android:requestLegacyExternalStorage="true"` in the `application` tag
10
10
  * in the `AndroidManifest.xml`.
11
11
  * On Android 11 or newer the app can only access the files/folders the app created.
@@ -55,14 +55,36 @@ export var Directory;
55
55
  * The external storage directory.
56
56
  * On iOS it will use the Documents directory.
57
57
  * On Android it's the primary shared/external storage directory.
58
- * It's not accesible on Android 10 unless the app enables legacy External Storage
58
+ * It's not accessible on Android 10 unless the app enables legacy External Storage
59
59
  * by adding `android:requestLegacyExternalStorage="true"` in the `application` tag
60
60
  * in the `AndroidManifest.xml`.
61
- * It's not accesible on Android 11 or newer.
61
+ * It's not accessible on Android 11 or newer.
62
62
  *
63
63
  * @since 1.0.0
64
64
  */
65
65
  Directory["ExternalStorage"] = "EXTERNAL_STORAGE";
66
+ /**
67
+ * The external cache directory.
68
+ * On iOS it will use the Documents directory.
69
+ * On Android it's the primary shared/external cache.
70
+ *
71
+ * @since 7.1.0
72
+ */
73
+ Directory["ExternalCache"] = "EXTERNAL_CACHE";
74
+ /**
75
+ * The Library directory without cloud backup. Used in iOS.
76
+ * On Android it's the directory holding application files.
77
+ *
78
+ * @since 7.1.0
79
+ */
80
+ Directory["LibraryNoCloud"] = "LIBRARY_NO_CLOUD";
81
+ /**
82
+ * A temporary directory for iOS.
83
+ * On Android it's the directory holding the application cache.
84
+ *
85
+ * @since 7.1.0
86
+ */
87
+ Directory["Temporary"] = "TEMPORARY";
66
88
  })(Directory || (Directory = {}));
67
89
  export var Encoding;
68
90
  (function (Encoding) {
@@ -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;AAimBD;;;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>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 5.2.0\n */\n removeAllListeners(): Promise<void>;\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":"AAQA,MAAM,CAAN,IAAY,SA8FX;AA9FD,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;IAEH,iDAAoC,CAAA;IACpC;;;;;;OAMG;IACH,6CAAgC,CAAA;IAEhC;;;;;OAKG;IACH,gDAAmC,CAAA;IAEnC;;;;;OAKG;IACH,oCAAuB,CAAA;AACzB,CAAC,EA9FW,SAAS,KAAT,SAAS,QA8FpB;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;AA+mBD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["import type { HttpOptions, PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport type CallbackID = string;\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 accessible 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 accessible 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 accessible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n\n ExternalStorage = 'EXTERNAL_STORAGE',\n /**\n * The external cache directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external cache.\n *\n * @since 7.1.0\n */\n ExternalCache = 'EXTERNAL_CACHE',\n\n /**\n * The Library directory without cloud backup. Used in iOS.\n * On Android it's the directory holding application files.\n *\n * @since 7.1.0\n */\n LibraryNoCloud = 'LIBRARY_NO_CLOUD',\n\n /**\n * A temporary directory for iOS.\n * On Android it's the directory holding the application cache.\n *\n * @since 7.1.0\n */\n Temporary = 'TEMPORARY',\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 ReadFileInChunksOptions extends ReadFileOptions {\n /**\n * Size of the chunks in bytes.\n *\n * @since 7.1.0\n */\n chunkSize: number;\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 * @since 7.1.0\n */\n name: string;\n\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 7.1.0\n */\n ctime?: number;\n\n /**\n * Time of last modification in milliseconds.\n *\n * @since 7.1.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 type StatResult = FileInfo;\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}\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 * Callback for receiving chunks read from a file, or error if something went wrong.\n *\n * @since 7.1.0\n */\nexport type ReadFileInChunksCallback = (chunkRead: ReadFileResult | null, err?: any) => void;\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 * 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 * Read a file from disk\n *\n * @since 1.0.0\n */\n readFile(options: ReadFileOptions): Promise<ReadFileResult>;\n\n /**\n * Read a file from disk, in chunks.\n * Native only (not available in web).\n * Use the callback to receive each read chunk.\n * If empty chunk is returned, it means file has been completely read.\n *\n * @since 7.1.0\n */\n readFileInChunks(options: ReadFileInChunksOptions, callback: ReadFileInChunksCallback): Promise<CallbackID>;\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 * Perform a http request to a server and download the file to the specified destination.\n *\n * This method has been deprecated since version 7.1.0.\n * We recommend using the @capacitor/file-transfer plugin instead, in conjunction with this plugin.\n *\n * @since 5.1.0\n * @deprecated Use the @capacitor/file-transfer plugin instead.\n */\n downloadFile(options: DownloadFileOptions): Promise<DownloadFileResult>;\n\n /**\n * Add a listener to file download progress events.\n *\n * This method has been deprecated since version 7.1.0.\n * We recommend using the @capacitor/file-transfer plugin instead, in conjunction with this plugin.\n *\n * @since 5.1.0\n * @deprecated Use the @capacitor/file-transfer plugin instead.\n */\n addListener(eventName: 'progress', listenerFunc: ProgressListener): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * This method has been deprecated since version 7.1.0.\n * We recommend using the @capacitor/file-transfer plugin instead, in conjunction with this plugin.\n *\n * @since 5.2.0\n * @deprecated Use the @capacitor/file-transfer plugin instead.\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * Structure for errors returned by the plugin.\n *\n * `code` follows \"OS-PLUG-FILE-XXXX\" format\n *\n * @since 1.0.0\n */\nexport type PluginError = {\n code: string;\n message: string;\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/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { registerPlugin } from '@capacitor/core';
2
+ import { exposeSynapse } from '@capacitor/synapse';
2
3
  const Filesystem = registerPlugin('Filesystem', {
3
- web: () => import('./web').then(m => new m.FilesystemWeb()),
4
+ web: () => import('./web').then((m) => new m.FilesystemWeb()),
4
5
  });
6
+ exposeSynapse();
5
7
  export * from './definitions';
6
8
  export { Filesystem };
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;CAC5D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { FilesystemPlugin } from './definitions';\n\nconst Filesystem = registerPlugin<FilesystemPlugin>('Filesystem', {\n web: () => import('./web').then(m => new m.FilesystemWeb()),\n});\n\nexport * from './definitions';\nexport { Filesystem };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,aAAa,EAAE,CAAC;AAEhB,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\nimport { exposeSynapse } from '@capacitor/synapse';\n\nimport type { FilesystemPlugin } from './definitions';\n\nconst Filesystem = registerPlugin<FilesystemPlugin>('Filesystem', {\n web: () => import('./web').then((m) => new m.FilesystemWeb()),\n});\n\nexposeSynapse();\n\nexport * from './definitions';\nexport { Filesystem };\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { AppendFileOptions, CopyOptions, CopyResult, DeleteFileOptions, FilesystemPlugin, GetUriOptions, GetUriResult, MkdirOptions, PermissionStatus, ReadFileOptions, ReadFileResult, ReaddirOptions, ReaddirResult, RenameOptions, RmdirOptions, StatOptions, StatResult, WriteFileOptions, WriteFileResult, DownloadFileOptions, DownloadFileResult } from './definitions';
2
+ import type { AppendFileOptions, CopyOptions, CopyResult, DeleteFileOptions, FilesystemPlugin, GetUriOptions, GetUriResult, MkdirOptions, PermissionStatus, ReadFileOptions, ReadFileResult, ReaddirOptions, ReaddirResult, RenameOptions, RmdirOptions, StatOptions, StatResult, WriteFileOptions, WriteFileResult, ReadFileInChunksOptions, CallbackID, DownloadFileOptions, DownloadFileResult, ReadFileInChunksCallback } from './definitions';
3
3
  export declare class FilesystemWeb extends WebPlugin implements FilesystemPlugin {
4
+ readFileInChunks(_options: ReadFileInChunksOptions, _callback: ReadFileInChunksCallback): Promise<CallbackID>;
4
5
  DB_VERSION: number;
5
6
  DB_NAME: string;
6
7
  private _writeCmds;
@@ -89,6 +90,7 @@ export declare class FilesystemWeb extends WebPlugin implements FilesystemPlugin
89
90
  /**
90
91
  * Function that performs a http request to a server and downloads the file to the specified destination
91
92
  *
93
+ * @deprecated Use the @capacitor/file-transfer plugin instead.
92
94
  * @param options the options for the download operation
93
95
  * @returns a promise that resolves with the download file result
94
96
  */
package/dist/esm/web.js CHANGED
@@ -1,12 +1,10 @@
1
1
  import { WebPlugin, buildRequestInit } from '@capacitor/core';
2
2
  import { Encoding } from './definitions';
3
3
  function resolve(path) {
4
- const posix = path.split('/').filter(item => item !== '.');
4
+ const posix = path.split('/').filter((item) => item !== '.');
5
5
  const newPosix = [];
6
- posix.forEach(item => {
7
- if (item === '..' &&
8
- newPosix.length > 0 &&
9
- newPosix[newPosix.length - 1] !== '..') {
6
+ posix.forEach((item) => {
7
+ if (item === '..' && newPosix.length > 0 && newPosix[newPosix.length - 1] !== '..') {
10
8
  newPosix.pop();
11
9
  }
12
10
  else {
@@ -20,8 +18,7 @@ function isPathParent(parent, children) {
20
18
  children = resolve(children);
21
19
  const pathsA = parent.split('/');
22
20
  const pathsB = children.split('/');
23
- return (parent !== children &&
24
- pathsA.every((value, index) => value === pathsB[index]));
21
+ return parent !== children && pathsA.every((value, index) => value === pathsB[index]);
25
22
  }
26
23
  export class FilesystemWeb extends WebPlugin {
27
24
  constructor() {
@@ -32,6 +29,7 @@ export class FilesystemWeb extends WebPlugin {
32
29
  /**
33
30
  * Function that performs a http request to a server and downloads the file to the specified destination
34
31
  *
32
+ * @deprecated Use the @capacitor/file-transfer plugin instead.
35
33
  * @param options the options for the download operation
36
34
  * @returns a promise that resolves with the download file result
37
35
  */
@@ -82,6 +80,9 @@ export class FilesystemWeb extends WebPlugin {
82
80
  return { path: result.uri, blob };
83
81
  };
84
82
  }
83
+ readFileInChunks(_options, _callback) {
84
+ throw this.unavailable('Method not implemented.');
85
+ }
85
86
  async initDb() {
86
87
  if (this._db !== undefined) {
87
88
  return this._db;
@@ -278,9 +279,7 @@ export class FilesystemWeb extends WebPlugin {
278
279
  const entry = (await this.dbRequest('get', [path]));
279
280
  if (entry === undefined)
280
281
  throw Error('File does not exist.');
281
- const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [
282
- IDBKeyRange.only(path),
283
- ]);
282
+ const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);
284
283
  if (entries.length !== 0)
285
284
  throw Error('Folder is not empty.');
286
285
  await this.dbRequest('delete', [path]);
@@ -405,6 +404,7 @@ export class FilesystemWeb extends WebPlugin {
405
404
  if (entry === undefined)
406
405
  throw Error('Entry does not exist.');
407
406
  return {
407
+ name: entry.path.substring(path.length + 1),
408
408
  type: entry.type,
409
409
  size: entry.size,
410
410
  ctime: entry.ctime,