Hi there,
I’ve downloaded a file from my webserver using the following code:
download = () : void => {
this.platform.ready().then(() => {
let pathToSaveTo = "";
let filename = this.url.substring(this.url.lastIndexOf('/') + 1);
if (this.platform.is('android')) {
pathToSaveTo = cordova.file.dataDirectory + filename;
}
else if(this.platform.is('ios')) {
pathToSaveTo = cordova.file.dataDirectory + filename;
}
let ft = new Transfer();
ft.download(this.url, pathToSaveTo).then(() => {
this.savedTo = pathToSaveTo;
});
})
}
I’m having a lot of trouble finding out a way to then open the .txt file and read the text inside. I’ve looked for quite a while, and it seems like using Ionic native would be the best, but how exactly would I go about that? If someone could provide an example I would really appreciate it.
Thanks!