【发布时间】:2015-12-26 01:46:29
【问题描述】:
我正在尝试将一些数据写入文件并将其保存在移动设备的内存中。我正在开发一个安装了cordova-plugin-file 的cordova 项目。一切似乎都在正常工作,但没有创建任何文件,因此没有保存任何数据...... 为什么即使我将创建标志设置为 true,getFile() 也不创建任何文件?
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, success, fail);
function success(fileSystem) {
window.rootFS = fileSystem.root;
window.rootFS.getFile("TestFile.txt", { create:true }, onSuccess, onFail);
function onSuccess() {
//write something on the file
}
function onFail(error) {
//show error
}
function fail(error) {
alert("Failed to retrieve file: " + error.code);
}
【问题讨论】:
标签: javascript android file cordova hybrid