javascript - 如何增加window.localStorage中限制的ELECTRON文件大小的大小限制?

标签 javascript angular ecmascript-6 electron electron-packager

我需要增加可以保存到本地系统的文件大小,但是此过程(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/

相关文章:

javascript - 模块变量无法使用 DOM 元素启动

javascript - 在js文件中加载html文件

angular - 如何模拟和监视测试套件中的 namespace ?

javascript - 如果与 es6 箭头函数一起使用,React.createClass 中的词法范围为 'this'

javascript - 带 rails 的自定义国家/州下拉菜单

javascript - 将 toString 方法暴露给 nashorn 中的 js 对象

javascript - 脚本在 woocommerce "place order"部分不起作用

javascript - ForEach 内部 API 无法正常工作

javascript - 过滤拒绝的 promise

javascript - 如何输出JSON格式的数据?