Downlod file path issue

When the file will be downloaded. I want to create an app name folder, then i want to download file store into my app name folder.

I’m guessing that you are using

@ionic-native/file-transfer

so i hope this code help you

import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer';
import { File } from '@ionic-native/file';


constructor(private transfer: FileTransfer, private file: File, ...){}

const fileTransfer: FileTransferObject = this.transfer.create();

fileTransfer.download(yourDownloadUrl , this.file.externalRootDirectory + '/foldername/yourFileName.yourFileExtension').then((entry) => {
    console.log('download complete: ' + entry.toURL());
}, (error) => {
	console.log('download error: ' + error);
});

this shoud create a folder named “foldername” and download your file in it

1 Like