ローカルファイルシステムを利用する
以下のコードをブラウザのコンソールから実行して、動作を確認してください
※Chromeからローカル環境のファイルを開き、コンソールから確認する場合、 "--allow-file-access-from-files" オプション付きのChromeを実行する必要があります。
// 一時的なデータを保存する領域を確保する window.webkitRequestFileSystem(TEMPORARY, 1024*1024, function(fs) { console.log('Success! - webkitRequestFileSystem: ' + fs.name); }, function(error) { console.log(error); });
// 永続的なファイルシステムを要求し、成功すればファイルシステムの情報を表示する navigator.webkitPersistentStorage.requestQuota(1024*1024, function(bytes) { window.webkitRequestFileSystem(PERSISTENT, bytes, function(fs) { navigator.webkitPersistentStorage.queryUsageAndQuota(function(usage, quota) { console.log('使用量: ' + usage); console.log('総容量: ' + quota); }, function(error) { console.log(error); }); }, function(error) { console.log(error); }); }, function(error) { console.log(error); });