From 0317d4455f31e002019909a23285c7f05f351f58 Mon Sep 17 00:00:00 2001 From: twaldecker Date: Thu, 27 Oct 2016 12:30:02 +0200 Subject: [PATCH] docs(transfer): add how-to download files (#745) also add information how to browse your app files directory, which is hard to find. I needed very long time to check where my files are. --- src/plugins/filetransfer.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/plugins/filetransfer.ts b/src/plugins/filetransfer.ts index 73991d117..334d67095 100644 --- a/src/plugins/filetransfer.ts +++ b/src/plugins/filetransfer.ts @@ -148,8 +148,29 @@ export interface FileTransferError { * }) * } * + * // Cordova + * declare var cordova: any; + * + * download() { + * const fileTransfer = new Transfer(); + * let url = 'http://www.example.com/file.pdf'; + * fileTransfer.download(url, cordova.file.dataDirectory + 'file.pdf').then((entry) => { + * console.log('download complete: ' + entry.toURL()); + * }, (error) => { + * // handle error + * }); + * } + * * ``` * + * Note: You will not see your documents using a file explorer on your device. Use adb: + * + * ``` + * adb shell + * run-as com.your.app + * cd files + * ls + * ``` */ @Plugin({ name: 'FileTransfer',