var localFileSystem;
function errorHandler(e)
{
console.log('Error: ' + e.name + ": " + e.message);
}
function initFS(fs)
{
localFileSystem = fs;
createFile('testFile.txt');
}
function createFile(filename)
{
localFileSystem.root.getFile
(
filename,
{create: true},
function(fileEntry)
{
console.log("Файл " + filename + " создан");
},
errorHandler
);
}
navigator.webkitPersistentStorage.requestQuota
(
10 * 1024 * 1024,
function(grantedBytes)
{
window.webkitRequestFileSystem
(
PERSISTENT,
grantedBytes,
initFS,
errorHandler
);
},
errorHandler
);