@capacitor/filesystem 5.0.6-nightly-20230712T151609.0 → 5.1.1-nightly-20230713T150800.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
@@ -101,6 +101,8 @@ const readFilePath = async () => {
101
101
  * [`copy(...)`](#copy)
102
102
  * [`checkPermissions()`](#checkpermissions)
103
103
  * [`requestPermissions()`](#requestpermissions)
104
+ * [`downloadFile(...)`](#downloadfile)
105
+ * [`addListener('progress', ...)`](#addlistenerprogress)
104
106
  * [Interfaces](#interfaces)
105
107
  * [Type Aliases](#type-aliases)
106
108
  * [Enums](#enums)
@@ -343,6 +345,45 @@ Required on Android, only when using <a href="#directory">`Directory.Documents`<
343
345
  --------------------
344
346
 
345
347
 
348
+ ### downloadFile(...)
349
+
350
+ ```typescript
351
+ downloadFile(options: DownloadFileOptions) => Promise<DownloadFileResult>
352
+ ```
353
+
354
+ Perform a http request to a server and download the file to the specified destination.
355
+
356
+ | Param | Type |
357
+ | ------------- | ------------------------------------------------------------------- |
358
+ | **`options`** | <code><a href="#downloadfileoptions">DownloadFileOptions</a></code> |
359
+
360
+ **Returns:** <code>Promise&lt;<a href="#downloadfileresult">DownloadFileResult</a>&gt;</code>
361
+
362
+ **Since:** 5.1.0
363
+
364
+ --------------------
365
+
366
+
367
+ ### addListener('progress', ...)
368
+
369
+ ```typescript
370
+ addListener(eventName: 'progress', listenerFunc: ProgressListener) => Promise<PluginListenerHandle> & PluginListenerHandle
371
+ ```
372
+
373
+ Add a listener to file download progress events.
374
+
375
+ | Param | Type |
376
+ | ------------------ | ------------------------------------------------------------- |
377
+ | **`eventName`** | <code>'progress'</code> |
378
+ | **`listenerFunc`** | <code><a href="#progresslistener">ProgressListener</a></code> |
379
+
380
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
381
+
382
+ **Since:** 5.1.0
383
+
384
+ --------------------
385
+
386
+
346
387
  ### Interfaces
347
388
 
348
389
 
@@ -428,7 +469,7 @@ Required on Android, only when using <a href="#directory">`Directory.Documents`<
428
469
  | Prop | Type | Description | Since |
429
470
  | ----------- | ---------------------------------- | ------------------------------------------------------------------------------------ | ----- |
430
471
  | **`name`** | <code>string</code> | Name of the file or directory. | |
431
- | **`type`** | <code>'directory' \| 'file'</code> | Type of the file. | 4.0.0 |
472
+ | **`type`** | <code>'file' \| 'directory'</code> | Type of the file. | 4.0.0 |
432
473
  | **`size`** | <code>number</code> | Size of the file in bytes. | 4.0.0 |
433
474
  | **`ctime`** | <code>number</code> | Time of creation in milliseconds. It's not available on Android 7 and older devices. | 4.0.0 |
434
475
  | **`mtime`** | <code>number</code> | Time of last modification in milliseconds. | 4.0.0 |
@@ -462,7 +503,7 @@ Required on Android, only when using <a href="#directory">`Directory.Documents`<
462
503
 
463
504
  | Prop | Type | Description | Since |
464
505
  | ----------- | ---------------------------------- | ------------------------------------------------------------------------------------ | ----- |
465
- | **`type`** | <code>'directory' \| 'file'</code> | Type of the file. | 1.0.0 |
506
+ | **`type`** | <code>'file' \| 'directory'</code> | Type of the file. | 1.0.0 |
466
507
  | **`size`** | <code>number</code> | Size of the file in bytes. | 1.0.0 |
467
508
  | **`ctime`** | <code>number</code> | Time of creation in milliseconds. It's not available on Android 7 and older devices. | 1.0.0 |
468
509
  | **`mtime`** | <code>number</code> | Time of last modification in milliseconds. | 1.0.0 |
@@ -501,6 +542,39 @@ Required on Android, only when using <a href="#directory">`Directory.Documents`<
501
542
  | **`publicStorage`** | <code><a href="#permissionstate">PermissionState</a></code> |
502
543
 
503
544
 
545
+ #### DownloadFileResult
546
+
547
+ | Prop | Type | Description | Since |
548
+ | ---------- | ------------------- | -------------------------------------------------------------------- | ----- |
549
+ | **`path`** | <code>string</code> | The path the file was downloaded to. | 5.1.0 |
550
+ | **`blob`** | <code>Blob</code> | The blob data of the downloaded file. This is only available on web. | 5.1.0 |
551
+
552
+
553
+ #### DownloadFileOptions
554
+
555
+ | Prop | Type | Description | Since |
556
+ | --------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
557
+ | **`path`** | <code>string</code> | The path the downloaded file should be moved to. | 5.1.0 |
558
+ | **`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 |
559
+ | **`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 |
560
+
561
+
562
+ #### PluginListenerHandle
563
+
564
+ | Prop | Type |
565
+ | ------------ | ----------------------------------------- |
566
+ | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
567
+
568
+
569
+ #### ProgressStatus
570
+
571
+ | Prop | Type | Description | Since |
572
+ | ------------------- | ------------------- | ---------------------------------------------------- | ----- |
573
+ | **`url`** | <code>string</code> | The url of the file being downloaded. | 5.1.0 |
574
+ | **`bytes`** | <code>number</code> | The number of bytes downloaded so far. | 5.1.0 |
575
+ | **`contentLength`** | <code>number</code> | The total number of bytes to download for this file. | 5.1.0 |
576
+
577
+
504
578
  ### Type Aliases
505
579
 
506
580
 
@@ -514,6 +588,13 @@ Required on Android, only when using <a href="#directory">`Directory.Documents`<
514
588
  <code>'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'</code>
515
589
 
516
590
 
591
+ #### ProgressListener
592
+
593
+ A listener function that receives progress events.
594
+
595
+ <code>(progress: <a href="#progressstatus">ProgressStatus</a>): void</code>
596
+
597
+
517
598
  ### Enums
518
599
 
519
600
 
@@ -7,10 +7,27 @@ import android.util.Base64;
7
7
  import com.capacitorjs.plugins.filesystem.exceptions.CopyFailedException;
8
8
  import com.capacitorjs.plugins.filesystem.exceptions.DirectoryExistsException;
9
9
  import com.capacitorjs.plugins.filesystem.exceptions.DirectoryNotFoundException;
10
- import java.io.*;
10
+ import com.getcapacitor.Bridge;
11
+ import com.getcapacitor.JSObject;
12
+ import com.getcapacitor.PluginCall;
13
+ import com.getcapacitor.plugin.util.CapacitorHttpUrlConnection;
14
+ import com.getcapacitor.plugin.util.HttpRequestHandler;
15
+ import java.io.BufferedWriter;
16
+ import java.io.ByteArrayOutputStream;
17
+ import java.io.File;
18
+ import java.io.FileInputStream;
19
+ import java.io.FileNotFoundException;
20
+ import java.io.FileOutputStream;
21
+ import java.io.IOException;
22
+ import java.io.InputStream;
23
+ import java.io.OutputStreamWriter;
24
+ import java.net.URISyntaxException;
25
+ import java.net.URL;
11
26
  import java.nio.channels.FileChannel;
12
27
  import java.nio.charset.Charset;
13
28
  import java.nio.charset.StandardCharsets;
29
+ import java.util.Locale;
30
+ import org.json.JSONException;
14
31
 
15
32
  public class Filesystem {
16
33
 
@@ -285,4 +302,82 @@ public class Filesystem {
285
302
  destination.transferFrom(source, 0, source.size());
286
303
  }
287
304
  }
305
+
306
+ public JSObject downloadFile(PluginCall call, Bridge bridge, HttpRequestHandler.ProgressEmitter emitter)
307
+ throws IOException, URISyntaxException, JSONException {
308
+ String urlString = call.getString("url", "");
309
+ JSObject headers = call.getObject("headers", new JSObject());
310
+ JSObject params = call.getObject("params", new JSObject());
311
+ Integer connectTimeout = call.getInt("connectTimeout");
312
+ Integer readTimeout = call.getInt("readTimeout");
313
+ Boolean disableRedirects = call.getBoolean("disableRedirects");
314
+ Boolean shouldEncode = call.getBoolean("shouldEncodeUrlParams", true);
315
+ Boolean progress = call.getBoolean("progress", false);
316
+
317
+ String method = call.getString("method", "GET").toUpperCase(Locale.ROOT);
318
+ String path = call.getString("path");
319
+ String directory = call.getString("directory", Environment.DIRECTORY_DOWNLOADS);
320
+
321
+ final URL url = new URL(urlString);
322
+ final File file = getFileObject(path, directory);
323
+
324
+ HttpRequestHandler.HttpURLConnectionBuilder connectionBuilder = new HttpRequestHandler.HttpURLConnectionBuilder()
325
+ .setUrl(url)
326
+ .setMethod(method)
327
+ .setHeaders(headers)
328
+ .setUrlParams(params, shouldEncode)
329
+ .setConnectTimeout(connectTimeout)
330
+ .setReadTimeout(readTimeout)
331
+ .setDisableRedirects(disableRedirects)
332
+ .openConnection();
333
+
334
+ CapacitorHttpUrlConnection connection = connectionBuilder.build();
335
+
336
+ connection.setSSLSocketFactory(bridge);
337
+
338
+ InputStream connectionInputStream = connection.getInputStream();
339
+ FileOutputStream fileOutputStream = new FileOutputStream(file, false);
340
+
341
+ String contentLength = connection.getHeaderField("content-length");
342
+ int bytes = 0;
343
+ int maxBytes = 0;
344
+
345
+ try {
346
+ maxBytes = contentLength != null ? Integer.parseInt(contentLength) : 0;
347
+ } catch (NumberFormatException ignored) {}
348
+
349
+ byte[] buffer = new byte[1024];
350
+ int len;
351
+
352
+ // Throttle emitter to 100ms so it doesn't slow down app
353
+ long lastEmitTime = System.currentTimeMillis();
354
+ long minEmitIntervalMillis = 100;
355
+
356
+ while ((len = connectionInputStream.read(buffer)) > 0) {
357
+ fileOutputStream.write(buffer, 0, len);
358
+
359
+ bytes += len;
360
+
361
+ if (progress && null != emitter) {
362
+ long currentTime = System.currentTimeMillis();
363
+ if (currentTime - lastEmitTime > minEmitIntervalMillis) {
364
+ emitter.emit(bytes, maxBytes);
365
+ lastEmitTime = currentTime;
366
+ }
367
+ }
368
+ }
369
+
370
+ if (progress && null != emitter) {
371
+ emitter.emit(bytes, maxBytes);
372
+ }
373
+
374
+ connectionInputStream.close();
375
+ fileOutputStream.close();
376
+
377
+ return new JSObject() {
378
+ {
379
+ put("path", file.getAbsolutePath());
380
+ }
381
+ };
382
+ }
288
383
  }
@@ -4,6 +4,7 @@ import android.Manifest;
4
4
  import android.media.MediaScannerConnection;
5
5
  import android.net.Uri;
6
6
  import android.os.Build;
7
+ import android.os.Environment;
7
8
  import com.capacitorjs.plugins.filesystem.exceptions.CopyFailedException;
8
9
  import com.capacitorjs.plugins.filesystem.exceptions.DirectoryExistsException;
9
10
  import com.capacitorjs.plugins.filesystem.exceptions.DirectoryNotFoundException;
@@ -17,7 +18,10 @@ import com.getcapacitor.PluginMethod;
17
18
  import com.getcapacitor.annotation.CapacitorPlugin;
18
19
  import com.getcapacitor.annotation.Permission;
19
20
  import com.getcapacitor.annotation.PermissionCallback;
20
- import java.io.*;
21
+ import com.getcapacitor.plugin.util.HttpRequestHandler;
22
+ import java.io.File;
23
+ import java.io.FileNotFoundException;
24
+ import java.io.IOException;
21
25
  import java.nio.charset.Charset;
22
26
  import java.nio.file.Files;
23
27
  import java.nio.file.attribute.BasicFileAttributes;
@@ -376,6 +380,31 @@ public class FilesystemPlugin extends Plugin {
376
380
  this._copy(call, false);
377
381
  }
378
382
 
383
+ @PluginMethod
384
+ public void downloadFile(PluginCall call) {
385
+ try {
386
+ String directory = call.getString("directory", Environment.DIRECTORY_DOWNLOADS);
387
+
388
+ if (isPublicDirectory(directory) && !isStoragePermissionGranted()) {
389
+ requestAllPermissions(call, "permissionCallback");
390
+ } else {
391
+ HttpRequestHandler.ProgressEmitter emitter = (bytes, contentLength) -> {
392
+ JSObject ret = new JSObject();
393
+ ret.put("url", call.getString("url"));
394
+ ret.put("bytes", bytes);
395
+ ret.put("contentLength", contentLength);
396
+
397
+ notifyListeners("progress", ret);
398
+ };
399
+
400
+ JSObject response = implementation.downloadFile(call, bridge, emitter);
401
+ call.resolve(response);
402
+ }
403
+ } catch (Exception ex) {
404
+ call.reject("Error downloading file: " + ex.getLocalizedMessage(), ex);
405
+ }
406
+ }
407
+
379
408
  private void _copy(PluginCall call, Boolean doRename) {
380
409
  String from = call.getString("from");
381
410
  String to = call.getString("to");
@@ -448,6 +477,9 @@ public class FilesystemPlugin extends Plugin {
448
477
  case "stat":
449
478
  stat(call);
450
479
  break;
480
+ case "downloadFile":
481
+ downloadFile(call);
482
+ break;
451
483
  }
452
484
  }
453
485
 
package/dist/docs.json CHANGED
@@ -297,6 +297,59 @@
297
297
  "PermissionStatus"
298
298
  ],
299
299
  "slug": "requestpermissions"
300
+ },
301
+ {
302
+ "name": "downloadFile",
303
+ "signature": "(options: DownloadFileOptions) => Promise<DownloadFileResult>",
304
+ "parameters": [
305
+ {
306
+ "name": "options",
307
+ "docs": "",
308
+ "type": "DownloadFileOptions"
309
+ }
310
+ ],
311
+ "returns": "Promise<DownloadFileResult>",
312
+ "tags": [
313
+ {
314
+ "name": "since",
315
+ "text": "5.1.0"
316
+ }
317
+ ],
318
+ "docs": "Perform a http request to a server and download the file to the specified destination.",
319
+ "complexTypes": [
320
+ "DownloadFileResult",
321
+ "DownloadFileOptions"
322
+ ],
323
+ "slug": "downloadfile"
324
+ },
325
+ {
326
+ "name": "addListener",
327
+ "signature": "(eventName: 'progress', listenerFunc: ProgressListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
328
+ "parameters": [
329
+ {
330
+ "name": "eventName",
331
+ "docs": "",
332
+ "type": "'progress'"
333
+ },
334
+ {
335
+ "name": "listenerFunc",
336
+ "docs": "",
337
+ "type": "ProgressListener"
338
+ }
339
+ ],
340
+ "returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
341
+ "tags": [
342
+ {
343
+ "name": "since",
344
+ "text": "5.1.0"
345
+ }
346
+ ],
347
+ "docs": "Add a listener to file download progress events.",
348
+ "complexTypes": [
349
+ "PluginListenerHandle",
350
+ "ProgressListener"
351
+ ],
352
+ "slug": "addlistenerprogress"
300
353
  }
301
354
  ],
302
355
  "properties": []
@@ -715,7 +768,7 @@
715
768
  ],
716
769
  "docs": "Type of the file.",
717
770
  "complexTypes": [],
718
- "type": "'directory' | 'file'"
771
+ "type": "'file' | 'directory'"
719
772
  },
720
773
  {
721
774
  "name": "size",
@@ -875,7 +928,7 @@
875
928
  ],
876
929
  "docs": "Type of the file.",
877
930
  "complexTypes": [],
878
- "type": "'directory' | 'file'"
931
+ "type": "'file' | 'directory'"
879
932
  },
880
933
  {
881
934
  "name": "size",
@@ -1061,6 +1114,149 @@
1061
1114
  "type": "PermissionState"
1062
1115
  }
1063
1116
  ]
1117
+ },
1118
+ {
1119
+ "name": "DownloadFileResult",
1120
+ "slug": "downloadfileresult",
1121
+ "docs": "",
1122
+ "tags": [],
1123
+ "methods": [],
1124
+ "properties": [
1125
+ {
1126
+ "name": "path",
1127
+ "tags": [
1128
+ {
1129
+ "text": "5.1.0",
1130
+ "name": "since"
1131
+ }
1132
+ ],
1133
+ "docs": "The path the file was downloaded to.",
1134
+ "complexTypes": [],
1135
+ "type": "string | undefined"
1136
+ },
1137
+ {
1138
+ "name": "blob",
1139
+ "tags": [
1140
+ {
1141
+ "text": "5.1.0",
1142
+ "name": "since"
1143
+ }
1144
+ ],
1145
+ "docs": "The blob data of the downloaded file.\nThis is only available on web.",
1146
+ "complexTypes": [
1147
+ "Blob"
1148
+ ],
1149
+ "type": "Blob"
1150
+ }
1151
+ ]
1152
+ },
1153
+ {
1154
+ "name": "DownloadFileOptions",
1155
+ "slug": "downloadfileoptions",
1156
+ "docs": "",
1157
+ "tags": [],
1158
+ "methods": [],
1159
+ "properties": [
1160
+ {
1161
+ "name": "path",
1162
+ "tags": [
1163
+ {
1164
+ "text": "5.1.0",
1165
+ "name": "since"
1166
+ }
1167
+ ],
1168
+ "docs": "The path the downloaded file should be moved to.",
1169
+ "complexTypes": [],
1170
+ "type": "string"
1171
+ },
1172
+ {
1173
+ "name": "directory",
1174
+ "tags": [
1175
+ {
1176
+ "text": "5.1.0",
1177
+ "name": "since"
1178
+ }
1179
+ ],
1180
+ "docs": "The directory to write the file to.\nIf this option is used, filePath can be a relative path rather than absolute.\nThe default is the `DATA` directory.",
1181
+ "complexTypes": [
1182
+ "Directory"
1183
+ ],
1184
+ "type": "Directory"
1185
+ },
1186
+ {
1187
+ "name": "progress",
1188
+ "tags": [
1189
+ {
1190
+ "text": "5.1.0",
1191
+ "name": "since"
1192
+ }
1193
+ ],
1194
+ "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
+ "complexTypes": [],
1196
+ "type": "boolean | undefined"
1197
+ }
1198
+ ]
1199
+ },
1200
+ {
1201
+ "name": "PluginListenerHandle",
1202
+ "slug": "pluginlistenerhandle",
1203
+ "docs": "",
1204
+ "tags": [],
1205
+ "methods": [],
1206
+ "properties": [
1207
+ {
1208
+ "name": "remove",
1209
+ "tags": [],
1210
+ "docs": "",
1211
+ "complexTypes": [],
1212
+ "type": "() => Promise<void>"
1213
+ }
1214
+ ]
1215
+ },
1216
+ {
1217
+ "name": "ProgressStatus",
1218
+ "slug": "progressstatus",
1219
+ "docs": "",
1220
+ "tags": [],
1221
+ "methods": [],
1222
+ "properties": [
1223
+ {
1224
+ "name": "url",
1225
+ "tags": [
1226
+ {
1227
+ "text": "5.1.0",
1228
+ "name": "since"
1229
+ }
1230
+ ],
1231
+ "docs": "The url of the file being downloaded.",
1232
+ "complexTypes": [],
1233
+ "type": "string"
1234
+ },
1235
+ {
1236
+ "name": "bytes",
1237
+ "tags": [
1238
+ {
1239
+ "text": "5.1.0",
1240
+ "name": "since"
1241
+ }
1242
+ ],
1243
+ "docs": "The number of bytes downloaded so far.",
1244
+ "complexTypes": [],
1245
+ "type": "number"
1246
+ },
1247
+ {
1248
+ "name": "contentLength",
1249
+ "tags": [
1250
+ {
1251
+ "text": "5.1.0",
1252
+ "name": "since"
1253
+ }
1254
+ ],
1255
+ "docs": "The total number of bytes to download for this file.",
1256
+ "complexTypes": [],
1257
+ "type": "number"
1258
+ }
1259
+ ]
1064
1260
  }
1065
1261
  ],
1066
1262
  "enums": [
@@ -1212,6 +1408,19 @@
1212
1408
  "complexTypes": []
1213
1409
  }
1214
1410
  ]
1411
+ },
1412
+ {
1413
+ "name": "ProgressListener",
1414
+ "slug": "progresslistener",
1415
+ "docs": "A listener function that receives progress events.",
1416
+ "types": [
1417
+ {
1418
+ "text": "(progress: ProgressStatus): void",
1419
+ "complexTypes": [
1420
+ "ProgressStatus"
1421
+ ]
1422
+ }
1423
+ ]
1215
1424
  }
1216
1425
  ],
1217
1426
  "pluginConfigs": []
@@ -1,4 +1,4 @@
1
- import type { PermissionState } from '@capacitor/core';
1
+ import type { HttpOptions, PermissionState, PluginListenerHandle } from '@capacitor/core';
2
2
  export interface PermissionStatus {
3
3
  publicStorage: PermissionState;
4
4
  }
@@ -417,6 +417,71 @@ export interface CopyResult {
417
417
  */
418
418
  uri: string;
419
419
  }
420
+ export interface DownloadFileOptions extends HttpOptions {
421
+ /**
422
+ * The path the downloaded file should be moved to.
423
+ *
424
+ * @since 5.1.0
425
+ */
426
+ path: string;
427
+ /**
428
+ * The directory to write the file to.
429
+ * If this option is used, filePath can be a relative path rather than absolute.
430
+ * The default is the `DATA` directory.
431
+ *
432
+ * @since 5.1.0
433
+ */
434
+ directory?: Directory;
435
+ /**
436
+ * An optional listener function to receive downloaded progress events.
437
+ * If this option is used, progress event should be dispatched on every chunk received.
438
+ * Chunks are throttled to every 100ms on Android/iOS to avoid slowdowns.
439
+ *
440
+ * @since 5.1.0
441
+ */
442
+ progress?: boolean;
443
+ }
444
+ export interface DownloadFileResult {
445
+ /**
446
+ * The path the file was downloaded to.
447
+ *
448
+ * @since 5.1.0
449
+ */
450
+ path?: string;
451
+ /**
452
+ * The blob data of the downloaded file.
453
+ * This is only available on web.
454
+ *
455
+ * @since 5.1.0
456
+ */
457
+ blob?: Blob;
458
+ }
459
+ export interface ProgressStatus {
460
+ /**
461
+ * The url of the file being downloaded.
462
+ *
463
+ * @since 5.1.0
464
+ */
465
+ url: string;
466
+ /**
467
+ * The number of bytes downloaded so far.
468
+ *
469
+ * @since 5.1.0
470
+ */
471
+ bytes: number;
472
+ /**
473
+ * The total number of bytes to download for this file.
474
+ *
475
+ * @since 5.1.0
476
+ */
477
+ contentLength: number;
478
+ }
479
+ /**
480
+ * A listener function that receives progress events.
481
+ *
482
+ * @since 5.1.0
483
+ */
484
+ export declare type ProgressListener = (progress: ProgressStatus) => void;
420
485
  export interface FilesystemPlugin {
421
486
  /**
422
487
  * Read a file from disk
@@ -500,6 +565,18 @@ export interface FilesystemPlugin {
500
565
  * @since 1.0.0
501
566
  */
502
567
  requestPermissions(): Promise<PermissionStatus>;
568
+ /**
569
+ * Perform a http request to a server and download the file to the specified destination.
570
+ *
571
+ * @since 5.1.0
572
+ */
573
+ downloadFile(options: DownloadFileOptions): Promise<DownloadFileResult>;
574
+ /**
575
+ * Add a listener to file download progress events.
576
+ *
577
+ * @since 5.1.0
578
+ */
579
+ addListener(eventName: 'progress', listenerFunc: ProgressListener): Promise<PluginListenerHandle> & PluginListenerHandle;
503
580
  }
504
581
  /**
505
582
  * @deprecated Use `ReadFileOptions`.