Calculating usage of localStorage space

后端 未结 12 1577
悲哀的现实
悲哀的现实 2020-11-27 10:28

I am creating an app using the Bespin editor and HTML5\'s localStorage. It stores all files locally and helps with grammar, uses JSLint and some other parsers for CSS and HT

12条回答
  •  天涯浪人
    2020-11-27 10:47

    This might help somebody. In chrome is possible to ask the user to allow to use more disk space if needed:

    // Request Quota (only for File System API)  
    window.webkitStorageInfo.requestQuota(PERSISTENT, 1024*1024, function(grantedBytes) {
      window.webkitRequestFileSystem(PERSISTENT, grantedBytes, onInitFs, errorHandler); 
    }, function(e) {
      console.log('Error', e); 
    });
    

    Visit https://developers.google.com/chrome/whitepapers/storage#asking_more for more info.

提交回复
热议问题