19

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

Nimantha
  • 6,405
  • 6
  • 28
  • 69
TimTheEnchanter
  • 3,370
  • 1
  • 26
  • 47

1 Answers1

1

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

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Wale
  • 1,321
  • 16
  • 11
  • 2
    Thanks for chiming in. Unfortunately, this doesn't settle things. The article you reference was written in 2017. This article was last updated in 2019 and contradicts what's in the 2017 article: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria#Storage_limits. This, among other things, is what is causing my (and apparently other people's) confusion. [1/2] – TimTheEnchanter Dec 04 '19 at 22:46
  • 3
    [2/2] This line in the article you referenced is also concerning: "If a web application attempts to store—using, for example, IndexedDB or the Cache Storage API—data that's large enough to bring a given origin over its available quota, the request will fail with a QuotaExceededError exception." Finally, calling persist will keep my data from being evicted, but it doesn't help with the quota question of how much I'm able to store to begin with. Since there is apparently no definitive answer in over a year, I'm planning to try to test this out and will report back what I find. – TimTheEnchanter Dec 04 '19 at 22:49