Download Files with the URL (firebase, Transfer)


#1

Hi i’m building an aplication with Firebase, and i want my users to upload and download any type of file to Direbase storage, the upload is succesfull but im am having problems with downloading files to the device. i’m doing the following:

first i got the download url from firebase -> i’ve done this

then whit that URL i use https://ionicframework.com/docs/v2/native/transfer/ whit the following code:

    declare var cordova: any;

    download(URL, NAME) {
      const fileTransfer = new Transfer();
      fileTransfer.download(URL, cordova.file.dataDirectory + 'NAME').then((entry) => {
        console.log('download complete: ' + entry.toURL());
      }, (error) => {
        // handle error
      });
}

It says download complete but i can not find the downloaded file, my question is how do i open the file? or how do i move it to a public folder so the user can see it.

PD: I know it says: “You will not see your documents using a file explorer on your device. Use adb:”, but i want the user to be able to see the download file in the explorer of the device.

any ideas

thanks


#2

i solve it just by changin cordova.file.dataDirectory to cordova.file.externalRootDirectory


#3

I also using that guide but I got error line when I import this=>import { File } from ‘@ionic-native/file’;
can you help me?


#4

Then Can you able to get the file??