我需要增加可以保存到本地系统的文件大小,但是此过程(window.localStorage)将文件大小限制为5MB/10MB。请查看代码-
import { Injectable } from '@angular/core';
@Injectable()
export class StorageService {
protected storage = window.localStorage;
constructor() { }
get(key) {
return JSON.parse(this.storage.getItem(key));
}
set(key, value) {
this.storage.setItem(key, JSON.stringify(value));
}
}
最佳答案
HTML标准不允许修改本地存储,而是将其硬编码到浏览器中。解释为什么需要这样做,以便人们可以提供其他解决方案。
User agents should limit the total amount of space allowed for storage areas, because hostile authors could otherwise use this feature to exhaust the user's available disk space.
A mostly arbitrary limit of five megabytes per origin is suggested. Implementation feedback is welcome and will be used to update this suggestion in the future.
https://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage
关于javascript - 如何增加window.localStorage中限制的ELECTRON文件大小的大小限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52468326/