简体   繁体   English

有没有办法让渐进式 web 应用程序在不耗尽所有 memory 的情况下保存大量数据?

[英]Is there a way for a progressive web app to save a lot of data without using up all the memory?

what i'm trying to do is save (2GB +-) of data for offline use.我要做的是保存(2GB +-)数据以供离线使用。 i do this using Dexie( wrapper for indexeddb) for my Progressive web app.我为我的 Progressive web 应用程序使用 Dexie(indexeddb 的包装器)来执行此操作。

My problem is that i use all of my laptops/android/IOS device's memory(RAM).我的问题是我使用了我所有的笔记本电脑/android/IOS 设备的内存(RAM)。

Is there a way for a progressive web app to save a lor of data without using up all the memory?有没有办法让渐进式 web 应用程序在不耗尽所有 memory 的情况下保存大量数据?

-localstorage has limits i think and also relies on memory or am i wrong? -localstorage 我认为有限制,并且还依赖于 memory 还是我错了? -Filesystem API is it possible? -文件系统 API 可能吗? -LargeLocalStorage is it possible? -LargeLocalStorage 可能吗? ( https://github.com/tantaman/LargeLocalStorage ) https://github.com/tantaman/LargeLocalStorage 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述

I wouldn't recommend using LargeLocalStorage, because that's an old project that uses old APIs which are not in use today (for example WebSQL in Safari).我不建议使用 LargeLocalStorage,因为这是一个使用旧 API 的旧项目,而这些旧 API 目前还没有使用(例如 Safari 中的 WebSQL)。

Solution for saving big files保存大文件的解决方案

I do recommend you to stay with IndexedDB , since it's widely supported (more than the Filesystem API which is only supported in Chrome). 我建议您继续使用 IndexedDB ,因为它得到了广泛的支持(超过了仅在 Chrome 中支持的文件系统 API )。 However, each of the browsers might limit you in the data that you can store per origin (and not per api, which can help you).但是,每个浏览器都可能限制您可以存储每个来源的数据(而不是每个 api,这可以帮助您)。 In Chrome for example it's up to 6% from your device free space.例如,在 Chrome 中,您的设备可用空间最多可达 6%。 In the link I've attached you can find more details.在我附加的链接中,您可以找到更多详细信息。 Of course, you can use the StorageQuota API to learn more about how much space you have left.当然,您可以使用StorageQuota API来详细了解您还剩多少空间。

Inspecting memory usage检查 memory 使用情况

If you meant memory as RAM and not HDD/SSD - I would suggest inspecting the memory in your device using Chrome dev tools .如果您将 memory 用作 RAM 而不是 HDD/SSD - 我建议您使用Chrome 开发工具检查设备中的 memory。 You can inspect Chrome on your device using Chrome on your workstation.您可以使用工作站上的 Chrome 检查设备上的 Chrome。 Afterwards, profile your memory and try to see what is using all of it然后, 分析您的 memory并尝试查看所有这些都在使用什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM