@capacitor/filesystem 7.1.0 → 7.1.2

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/Package.swift CHANGED
@@ -10,7 +10,7 @@ let package = Package(
10
10
  targets: ["FilesystemPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "7.1.0")
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
14
14
  ],
15
15
  targets: [
16
16
  .binaryTarget(
package/README.md CHANGED
@@ -42,6 +42,64 @@ For detailed steps on how to do this, please see the [Capacitor Docs](https://ca
42
42
  </plist>
43
43
  ```
44
44
 
45
+ ## Migrating from downloadFile to File Transfer plugin
46
+
47
+ As of version 7.1.0, the `downloadFile` functionality in the Filesystem plugin has been deprecated in favor of the new [@capacitor/file-transfer](https://capacitorjs.com/docs/apis/file-transfer) plugin.
48
+
49
+ ### Installing the File Transfer plugin
50
+
51
+ ```bash
52
+ npm install @capacitor/file-transfer
53
+ npx cap sync
54
+ ```
55
+
56
+ ### Migration example
57
+
58
+ Before (using Filesystem plugin):
59
+
60
+ ```typescript
61
+ import { Filesystem, Directory } from '@capacitor/filesystem';
62
+
63
+ await Filesystem.downloadFile({
64
+ url: 'https://example.com/file.pdf',
65
+ path: 'downloaded-file.pdf',
66
+ directory: Directory.Documents,
67
+ progress: true
68
+ });
69
+
70
+ // Progress events
71
+ Filesystem.addListener('progress', (progress) => {
72
+ console.log(`Downloaded ${progress.bytes} of ${progress.contentLength}`);
73
+ });
74
+ ```
75
+
76
+ After (using File Transfer plugin):
77
+
78
+ ```typescript
79
+ import { FileTransfer } from '@capacitor/file-transfer';
80
+ import { Filesystem, Directory } from '@capacitor/filesystem';
81
+
82
+ // First get the full file path using Filesystem
83
+ const fileInfo = await Filesystem.getUri({
84
+ directory: Directory.Documents,
85
+ path: 'downloaded-file.pdf'
86
+ });
87
+
88
+ // Then use the FileTransfer plugin to download
89
+ await FileTransfer.downloadFile({
90
+ url: 'https://example.com/file.pdf',
91
+ path: fileInfo.uri,
92
+ progress: true
93
+ });
94
+
95
+ // Progress events
96
+ FileTransfer.addListener('progress', (progress) => {
97
+ console.log(`Downloaded ${progress.bytes} of ${progress.contentLength}`);
98
+ });
99
+ ```
100
+
101
+ The File Transfer plugin offers improved reliability, better error handling with specific error codes, and also adds upload functionality.
102
+
45
103
  ## iOS
46
104
 
47
105
  To have files appear in the Files app, you must also set the following keys to `YES` in `Info.plist`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/filesystem",
3
- "version": "7.1.0",
3
+ "version": "7.1.2",
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",
@@ -46,7 +46,7 @@
46
46
  "prepublishOnly": "npm run build"
47
47
  },
48
48
  "dependencies": {
49
- "@capacitor/synapse": "^1.0.1"
49
+ "@capacitor/synapse": "^1.0.3"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@capacitor/android": "7.0.1",