How to create a custom downlod directory


#1

I want to create a custom root directory like whats app when user download the file from my app on that time create a new folder of my app name how can i do that?

below my code:

download(event,item){

this.platform.ready().then(() => {

      const fileTransfer: FileTransferObject = this.transfer.create();
      let getUrl = item._meta_gallery_images
      let downloadFileName = getUrl.substr(getUrl.lastIndexOf('/') + 1); 
      //const imageLocation = `${cordova.file.applicationDirectory}www/assets/img/${item}`;
      const url =   getUrl;
      var URL = encodeURI(url);
      fileTransfer.download(url, this.storageDirectory + downloadFileName).then((entry) => {

        const alertSuccess = this.alertCtrl.create({
          title: `Download Succeeded!`,
          subTitle: `${downloadFileName} was successfully downloaded to: ${entry.toURL()}`,
          buttons: ['Ok']
        });

        alertSuccess.present();

      }, (error) => {

        const alertFailure = this.alertCtrl.create({
          title: `Download Failed!`,
          subTitle: `${downloadFileName} was not successfully downloaded. Error code: ${error.code}`,
          buttons: ['Ok']
        });

        alertFailure.present();

      });

    });


}

Please help me anyone.
Thaks