0

I'm just trying out the file system API. As described in http://www.html5rocks.com/en/tutorials/file/filesystem

code:

window.webkitStorageInfo.requestQuota(PERSISTENT, 1024 * 1024, function (grantedBytes) {
   window.requestFileSystem(PERSISTENT, grantedBytes, successCallback, errorHandler);
}, function (e) {
   console.log('Error', e);
});    


function successCallback(fs) {
window.fileSystem = fs;
fs.root.getFile('kiki.txt', {
        create: false,
        exclusive: true
    },
    function (fileEntry) {
        // Create a FileWriter object for our FileEntry (log.txt).
        fileEntry.createWriter(function (fileWriter) {

            fileWriter.onwriteend = function (e) {
                console.log('Write completed.');
            };

            fileWriter.onerror = function (e) {
                console.log('Write failed: ' + e.toString());
            };

            fileWriter.seek(fileWriter.length); 
            // Create a new Blob and write it to log.txt.
            var blob = new Blob(['Lorem Ipsum'], {
                type: 'text/plain'
            });

            fileWriter.write(blob);

        }, errorHandler);
    }, errorHandler);

}

(the create: false is because I already created that file before).

Chrome asks permission to use the file system and I grant it. When I try to read it, I can, it's persistent. But where is it saved?

According to the docs, it is saved in the root folder ("/"), but it is not there (I'm using nginx). I search the entire HD for this file ("kiki.txt") and it is not found.

So where is it saved?

nadavelyashiv
  • 309
  • 1
  • 3
  • 12
  • See http://stackoverflow.com/questions/11676584/where-does-persistent-file-system-storage-store-with-chrome – fasouto Apr 28 '14 at 15:35

2 Answers2

2

You are using the HTML5 file system APIs but trying to find data files on the server. Client browsers will save the data most probably on the client's file system. Quote from the link you provided: http://www.html5rocks.com/en/tutorials/file/filesystem/

With the FileSystem API, a web app can create, read, navigate, and write to a sandboxed section of the user's local file system.

As for your question - each browser will have their own implementation of the HTML5 file system APIs and the data might be saved anywhere using custom format.

Nikolay Dimitrov
  • 1,766
  • 1
  • 14
  • 23
0

As a key value pair in a database stored in the user profile which may be different for each person based on operating system, browser, and configuration.

But here is one example, copied from:Where is the html5 local database located on a client machine?

C:\Users\<user>\AppData\Roaming\Mozilla\Firefox\Profiles\<profile-name>\webappsstore.sqlite
Community
  • 1
  • 1
davidcondrey
  • 34,416
  • 17
  • 114
  • 136