Quota exceeded trying to create file with HTML File API
Asked Answered
C

4

9

In a packaged Chrome app, I'm trying to read from a file in the PERSISTENT storage, and create it if it doesn't exist:

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);
});

But I'm getting The operation failed because it would cause the application to exceed its storage quota. error. TEMPORARY storage is giving me the same error. Is there anything I should specify in the manifest.json?

Carliecarlile answered 17/3, 2014 at 13:27 Comment(2)
You should request the required quota first: html5rocks.com/en/tutorials/file/filesystem/…Alfonsoalfonzo
@CBroe I get 0 when I print out grantedBytes.Carliecarlile
C
14

Adding unlimitedStorage to the manifest.json permissions fixed the issue.

Carliecarlile answered 17/3, 2014 at 14:49 Comment(0)
P
0

I had the same issue running a cordova app on a browser platform. I fixed the issue by removing useless (and old) files stored in filesytem directory. You can find this directory there (on windows8):

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

Hope this helps.

Potable answered 20/7, 2018 at 8:18 Comment(0)
V
0

i had same issue when my hybrid cordova application running on ripple -Chrome>settings>history>advance>checked all unnecessary files and delete.

Vena answered 26/12, 2019 at 6:27 Comment(0)
H
0

Or invoke chrome with --unlimited-storage parameter:

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

Hilleary answered 15/6, 2021 at 10:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.