So I am developing PWA with svelte + vite for taking reports which has picture and text in it's form, now all that data is saved on rxdb+lokijs+indexeddb, before I save the picture, I would compress it with svelte image encoder with 50% compression, and then the compressed base64 string would then be compressed again with lz-string.
Now the case here is, if a user has a high end device (Poco F1 with snapdragon 845) then there is no problem in saving the reports until let's say 100 reports before they decompress the compressed lz-string data call the backend API and save it to server DB and delete the one on Indexeddb, but when the user has a low end device such as (Xiaomi A1 with snapdragon 625) then after about 30 to 40 reports the device starts to get slower because of the amount of data saved,
I normally tested pictures with the original length of 100000 compressed it to 40000 and compressed it again to 17000
I am currently trying to search for a way to save the data to client device as picture.jpg and then just save the filename and directory in indexed DB, but I haven't got a good example out of it from the internet
If anyone have another approach on facing this problem that you would suggest to me, I would really appreciate it
I should also point out that the app must be a PWA and works offline because the user usually has lack of network when taking reports