gpt4 book ai didi

file - Ionic 2 文件插件 : how to create file in ionic 3

转载 作者:太空狗 更新时间:2023-10-29 19:29:31 26 4
gpt4 key购买 nike

我正在尝试在我的手机中创建一个文件,但我总是只调用其他部分

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

最佳答案

创建目录时使用代码

file.createDir(file.externalRootDirectory, 'silapathigaram', true).then((val) => {
console.log("Created");
}).catch(e => {
console.log("error is ",e);
});

关于file - Ionic 2 文件插件 : how to create file in ionic 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43449434/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com