渐进式Web应用程序是否可以在不耗尽所有内存的情况下保存大量数据? [英] Is there a way for a progressive web app to save a lot of data without using up all the memory?

查看:51
本文介绍了渐进式Web应用程序是否可以在不耗尽所有内存的情况下保存大量数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是保存(2GB +-)数据以供离线使用.我为我的渐进式Web应用程序使用Dexie(用于indexeddb的包装器)进行此操作.

我的问题是我使用了我的所有笔记本电脑/android/IOS设备的内存(RAM).

渐进式Web应用程序是否可以在不耗尽所有内存的情况下保存大量数据?

-localstorage有局限性,我还依赖于内存,还是我错了?-Filesystem API是否可能?-LargeLocalStorage有可能吗?(

解决方案

我不建议使用LargeLocalStorage,因为那是一个使用旧的API的旧项目,而这些API现已不使用(例如Safari中的WebSQL).

保存大文件的解决方案

我建议您保留在IndexedDB 上,因为它得到了广泛的支持(比仅Chrome支持的Filesystem API还要多).但是,每个浏览器可能会限制您只能按每个来源(而不是每个api,这可以为您提供帮助)存储数据.例如,在Chrome浏览器中,设备可用空间最多占6%.在我附加的链接中,您可以找到更多详细信息.当然,您可以使用 StorageQuota API 了解更多信息关于您还剩多少空间.

检查内存使用情况

如果您将内存表示为RAM,而不是HDD/SSD-我建议您使用检查设备中的内存Chrome开发者工具.您可以在工作站上使用Chrome浏览器检查设备上的Chrome .然后,配置您的内存,并尝试查看正在使用什么全部

what i'm trying to do is save (2GB +-) of data for offline use. i do this using Dexie( wrapper for indexeddb) for my Progressive web app.

My problem is that i use all of my laptops/android/IOS device's memory(RAM).

Is there a way for a progressive web app to save a lor of data without using up all the memory?

-localstorage has limits i think and also relies on memory or am i wrong ? -Filesystem API is it possible ? -LargeLocalStorage is it possible ? (

解决方案

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).

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). 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). In Chrome for example it's up to 6% from your device free space. 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.

Inspecting memory usage

If you meant memory as RAM and not HDD/SSD - I would suggest inspecting the memory in your device using Chrome dev tools. You can inspect Chrome on your device using Chrome on your workstation. Afterwards, profile your memory and try to see what is using all of it

这篇关于渐进式Web应用程序是否可以在不耗尽所有内存的情况下保存大量数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆