file.checkFile FileError {code: 1, message: "NOT_FOUND_ERR"}


#1

Hi,

I’m new to Ionic and I have trouble when I try to check if a file exists on android. I don’t know what’s wrong. I can see the file in the directory when I use listDir (this.file.listDir(this.file.applicationDirectory, ‘www/’)). But when I try: this.file.checkFile(this.file.applicationDirectory + ‘www/’, ‘database.db’) I got the error {code: 1, message: “NOT_FOUND_ERR”}.

My code:

this.file.listDir(this.file.applicationDirectory, ‘www/’)
.then(items =>{
for(let i in items){
console.log(items[i]); // I see “database.db” here
}
})
.catch(err => {
console.log(err);
});

this.file.checkFile(this.file.applicationDirectory + ‘www/’, ‘database.db’) // FileError {code: 1, message: “NOT_FOUND_ERR”}
.then(entry =>{
console.log(‘ok’);
})
.catch(err => {console.log(err)});


#2

The filename in your descriptive paragraph does not match the filename in the code.


#3

Oh, I forgot to change it when writing this post. Thank you