I am trying to create a file in my phone but I am always invoking only else part
app.component.ts
file.checkDir(file.dataDirectory, 'silapathigaram')
.then(_ => {
console.log('Directory exists');
})
.catch(err => {
console.log('Directory doesnt exist');
file.createDir('cordova.file.applicationDirectory', 'silapathigaram', false)
.then(
(files) => {
// do something
console.log("success");
}
).catch(
(err) => {
// do something
console.log("error"); // i am invoking only this part
}
);
});
what am I doing wrong? I am checking file name 'silapathigaram' and if it does not exist I am trying to create one
but I am invoking only error part my code
while creating the directory use code
file.createDir(file.externalRootDirectory, 'silapathigaram', true).then((val) => {
console.log("Created");
}).catch(e => {
console.log("error is ",e);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With