To download the File to the Download directory you need to use Cordova file and FileTransferPlugins.
import { File } from '@ionic-native/file'; import { FileTransfer } from '@ionic-native/file-transfer'; constructor(private transfer: FileTransfer) { } fileTransfer: FileTransferObject = this.transfer.create(); //Use your File Url and name downloadFile(file) { // Some Loading this.fileTransfer.download(url, this.file.externalRootDirectory + '/Download/' + file).then(response => { console.log(response); this.dismissLoading(); this.presentToast('File has been downloaded to the Downloads folder. View it..') }) .catch(err => { this.dismissLoading(); console.log(err) }); }
You can follow the link.
Question and answer is powered by AnsPress.io