【问题标题】:How to increase storage size in pouchDB如何增加 pouchDB 中的存储大小
【发布时间】:2018-01-28 09:02:30
【问题描述】:

我正在使用带有索引数据库适配器的 pouchDB 开发 ionic 3/angular 4 应用程序。我的查询是如何使用 ionic 3/angular 4 增加 pouchDB 中的索引 db 大小,因为我的 json 大小为 20mb,我想将其存储在 db 中以供离线应用。

非常感谢任何帮助:)

【问题讨论】:

    标签: angular ionic3 indexeddb pouchdb typescript2.0


    【解决方案1】:

    问题是“pouchdb core”的大小参数的打字稿(类型定义)被遗漏了。 在未来版本更新类型定义文件之前,您可能需要自己添加它

    在 index.d.ts (node_modules/@types/pouchdb-core/index.d.ts) 的第 516 行附近,在接口声明中。

    来自

    interface LocalDatabaseConfiguration extends CommonDatabaseConfiguration {
        auto_compaction?: boolean;
        revs_limit?: number;
    }
    

    interface LocalDatabaseConfiguration extends CommonDatabaseConfiguration {
            auto_compaction?: boolean;
            revs_limit?: number;
            size?: number;
    }
    

    已经提供了此更改的拉取请求,但到目前为止还没有进入最新版本

    【讨论】:

      【解决方案2】:

      对于 20mb,我认为您可以安全地使用大多数主流浏览器。

      • 基于 Chromium 的浏览器将根据可用磁盘空间进行计算,并允许应用程序存储多达 6% 的可用磁盘空间,这可能非常大。 chromium space calculation
      • Firefox 有 50mb 的初始限制,如果您的应用需要更多,然后会请求用户许可。
      • Mobile Safari 和 IE 分别有 50mb 和 250mb 的硬限制,非常烦人的需要间歇性地向用户请求权限。 see more information here

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-05-02
        • 2011-06-19
        • 2018-02-16
        • 1970-01-01
        • 2013-06-29
        • 1970-01-01
        • 2010-10-06
        相关资源
        最近更新 更多