尝试使用HTML文件API创建文件时,配额已超过

Quota exceeded trying to create file with HTML File API

本文关键字:文件 创建 HTML API      更新时间:2023-09-26

在一个打包的Chrome应用程序中,我试图从PERSISTENT存储中的文件读取,并创建它,如果它不存在:

window.webkitRequestFileSystem(PERSISTENT, 1024*1024, function(fileSystem) {
    fileSystem.root.getFile('file.txt', {create: true}, function(fileEntry) {
        fileEntry.file(function(file) {
            var reader = new FileReader();
            reader.onloadend = function(e) {
                console.log(this.result);
            };
            reader.readAsText(file);
         }, errorHandler);
    }, errorHandler);
});

但是我得到了The operation failed because it would cause the application to exceed its storage quota.错误。临时存储给了我同样的错误。manifest.json中有什么需要指定的吗?

添加unlimitedStorage到清单。Json权限修复问题

我在浏览器平台上运行cordova应用程序时遇到了同样的问题。我通过删除存储在文件系统目录中的无用(和旧)文件来修复这个问题。你可以在这里找到这个目录(在windows8上):

%userDirectory'AppData'Local'Google'Chrome'User Data'Default

我有同样的问题,当我的混合cordova应用程序运行在ripple -Chrome>settings>history>advance>检查所有不必要的文件和删除。

或调用chrome与--unlimited-storage参数:

"C:'Program Files'Google'Chrome'Application'chrome.exe" --unlimited-storage