angular - Property 'download' does not exist on type 'Transfer'. in ionic 2 FileTransfer -


i using ionic 2 file transfer native plugin in app download sample.csv file server.

facing below error message:

property 'download' not exist on type 'transfer'.

  const filetransfer = new transfer();   let url = 'url server file';      console.log(url);    filetransfer.download(url, cordova.file.datadirectory + 'sample.csv').then((entry) => {        console.log('download complete: ' + entry.tourl());    }, (error) => {                     console.log("no file download");    }); 

and in console getting cordova not defined.

can me ?

you have import this.

import { transfer, fileuploadoptions, transferobject } '@ionic-native/transfer'; import { file } '@ionic-native/file'; 

after inject this.

constructor(private transfer: transfer, private file: file) { } 

declare below.

const filetransfer: transferobject = this.transfer.create(); 

use this.

// download file: filetransfer.download(..).then(..).catch(..); 

you can refer official doc here.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -