I have been battling with file download in ionic 4 and it seems to be a big issue for me.
The below code is what i have tried using atlast but it seems not working as the same is downloading the file to a directory that i don’t have an idea in the device.
ownload(filename) {
const fileTransfer: FileTransferObject = this.transfer.create();
let name = filename.split("/");
let length = name.length;
const url ="http://vvvvvvvv.com/dashboardksi/api/uploads/" + name[length - 1];
console.log("clicked", name);
fileTransfer.download(url, this.file.dataDirectory + name[length - 1], true).then(entry => {
console.log("download complete: " + entry.toURL());
},
error => {
// handle error
console.log("ERROR: ", error);
}
);
I don’t know how i can save it to like downloads folder or gallery like that in case of images.