. , API- script, . - ? , , .
manifest.json:
{
"name": "Testing FS",
"manifest_version":2,
"version": "1.0",
"content_scripts": [
{
"matches":["*://*.google.com/*"],
"js":["script.js"]
}
]
}
script.js
webkitStorageInfo.requestQuota(webkitStorageInfo.TEMPORARY, 1024*1024, function(grantedBytes) {
console.log("bytes granted: ", grantedBytes);
window.webkitRequestFileSystem(webkitStorageInfo.TEMPORARY, grantedBytes, onInitFs, errorHandler)
}, errorHandler);
function errorHandler(e) {
console.log("FS error", e);
}
function onInitFs(fs) {
fs.root.getFile('log.txt', {create: true}, function(fileEntry) {
console.log(fileEntry);
}, errorHandler);
}