According to Exploring the FileSystem APIs at
Browser support & storage limitations
You may need the
--allow-file-access-from-filesflag if you're debugging your app fromfile://. Not using these flags will result in aSECURITY_ERRorQUOTA_EXCEEDED_ERRFileError.
Launched chromium with --allow-file-access-from-files , --unlimited-storage and possibly deprecated --unlimited-quota-for-files; also --unsafely-treat-insecure-origin-as-secure=file:///path/to/directory/* with --user-data-dir=/path/to/directory set.
Interestingly, when chromium opens a notification is displayed
You are using an unsupported command-line flag:
--unsafely-treat-insecure-origin-as-secure. Stability and security will suffer.
There are other flags which are not specified which can be used; ignored notification as was still able to set and get localStorage at file: protocol, spcecifically files at file:///path/to/directory/*, though
navigator.webkitTemporaryStorage.requestQuota(1024*1024, function(grantedBytes) {
console.log(grantedBytes)
}, errorHandler);
logged 0, where errorHandler is
function errorHandler(e) {
console.log(e)
}
Also
function writeFile(fs) {
fs.root.getFile("file.txt", {create: true}, function(fileEntry) {
fileEntry.createWriter(function(fileWriter) {
fileWriter.onwriteend = function(e) {
// call `readFile`
window.requestFileSystem(window.TEMPORARY, 1024*1024, readFile, errorHandler);
};
fileWriter.onerror = errorHandler;
var blob = new Blob(["abc"], {type: "text/plain"});
fileWriter.write(blob);
}, errorHandler);
}, errorHandler);
}
window.requestFileSystem(window.TEMPORARY, 1024*1024, writeFile, errorHandler);
function readFile(fs) {
fs.root.getFile("file.txt", {}, function(fileEntry) {
fileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function(e) {
console.log(e.target.result)
};
reader.readAsText(file);
}, errorHandler);
}, errorHandler);
}
logged
FileError {code: 7, name: "InvalidStateError", message: "An operation that depends on state cached in an in…he state had changed since it was read from disk."}
code:7
message:"An operation that depends on state cached in an interface object was made but the state had changed since it was read from disk."
name:"InvalidStateError"
__proto__:DOMError
Question: What are modifications necessary at launch flags, workarounds or other approaches that would allow use of webkitRequestFileSystem at file: protocol?