Electron IndexedDb limit?

Viewed 4041

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

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

Related