电子指数数据库极限? [英] Electron IndexedDb limit?
本文介绍了电子指数数据库极限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在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%的可用空间),会发生什么情况?
- 电子/铬是否会清除您的数据?
-Electron v3.0.4
推荐答案
2019年,我可以向您保证,您现在可以完全控制您的索引数据库数据。
根据谷歌的这篇文章:
https://developers.google.com/web/updates/2017/08/estimating-available-storage-space
上面的代码应该返回正确的配额大小。
但除此之外,现在调用此代码会使您的数据在&Quot;Exiction&Quot;中不可触及
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
这篇关于电子指数数据库极限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文