Quantcast
Channel: Saving file to Downloads directory using Ionic 3 - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by Naveen Patel for Saving file to Downloads directory using Ionic 3

$
0
0

To download the File to the Download directory you need to use Cordova File Plugin:

import { File } from '@ionic-native/file/ngx';constructor(    private file: File,  ) { }this.file.writeFile(this.file.externalRootDirectory +'/Download/', user_log.xlsx, blob, { replace: true }).then(() => {              alert('File has been downloaded. Please check your downloads folder.')    enter code here            },     (err) => {              alert("Sorry. An error occurred downloading the file: " + err);    enter code here            });          })

It works in Ionic 4 as well.


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>