Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron IndexedDb limit?

In this Electron issue, @zcbenz commented:

We have the same size limitation with Chrome browser, which is '1/3 of the of available disk space'.

That response was from early 2016.

I've run this code:

const estimation = await navigator.storage.estimate();
console.log(`Quota: ${estimation.quota}`);
console.log(`Usage: ${estimation.usage}`); 

and it tells me that I have 100% of my free disk space as my quota, so I'm confused and can't find anything more recent than the 2016 comment, that is also Electron-specific.

So my questions:

  • Has this officially changed?
  • What happens if you attempt to exceed that limit (assuming it's not really 100% of free space)?
  • Will Electron/Chromium ever evict your data?

--- Electron v3.0.4

like image 823
TimTheEnchanter Avatar asked Oct 22 '18 02:10

TimTheEnchanter


People also ask

What is the maximum size of IndexedDB?

The good news is the iOS Safari IndexedDB limit is up to 500MB*.

How much IndexedDB can store?

The only limits on the size of the IndexedDB database will be the user's disk space and operating system. The localStorage quota is 5000KB, and there is no way for a web site to ask the browser for permission to store more than that amount in localStorage.

Is IndexedDB deprecated?

The W3C has announced that the Web SQL database is a deprecated local storage specification so web developer should not use this technology any more. indexeddb is an alternative for web SQL data base and more effective than older technologies.

Is IndexedDB persistent?

Even though IndexedDB is a fully functional client-side database for the web, it is not a persistent storage by default. IndexedDB without StorageManager is just a “best-effort” database that can be erased in situations of low disk space on a device.


1 Answers

This 2019 and I can assure you that you now have full control over your indexdb data.
As per this article from Google: https://developers.google.com/web/updates/2017/08/estimating-available-storage-space
The code above should return the correct quota size.
But beyond that, calling this code now makes your data untouchable from "eviction"

if (navigator.storage && navigator.storage.persist)
  navigator.storage.persist().then(function(persistent) {
    if (persistent)
      console.log("Storage will not be cleared except by explicit user action");
    else
      console.log("Storage may be cleared by the UA under storage pressure.");
  });

https://developer.mozilla.org/en-US/docs/Web/API/StorageManager/persist

like image 183
Wale Avatar answered Oct 16 '22 13:10

Wale