Electron IndexedDb limit?

问题描述 投票:10回答:1

this Electron issue中,@ zcbenz评论说:“ 我们在Chrome浏览器中具有相同的大小限制,即可用磁盘空间的1/3””。该回复来自2016年初。

我已运行此代码:

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

它告诉我,我有100%的可用磁盘空间作为配额,所以我很困惑,找不到比2016年评论更新的东西,这也是Electron特定的。

所以我的问题:

  • 此正式更改了吗?
  • 如果您尝试超过该限制(假设实际上不是100%的可用空间,会发生什么?
  • 电子/铬会驱逐您的数据吗?

-电子v3.0.4

electron indexeddb
1个回答
0
投票

确定。我可以向这个2019年保证,您现在可以完全控制indexdb数据了。根据Google的这篇文章:https://developers.google.com/web/updates/2017/08/estimating-available-storage-space上面的代码应返回正确的配额大小。但除此之外,现在调用此代码将使您的数据无法被“逐出”]

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

© www.soinside.com 2019 - 2024. All rights reserved.