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

ぐ巨炮叔叔 提交于 2021-02-08 07:38:35

问题


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 ? (https://github.com/tantaman/LargeLocalStorage)


回答1:


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



来源:https://stackoverflow.com/questions/61122409/is-there-a-way-for-a-progressive-web-app-to-save-a-lot-of-data-without-using-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!