angular-localForage icon indicating copy to clipboard operation
angular-localForage copied to clipboard

Storage compression

Open ocombe opened this issue 10 years ago • 11 comments

We should offer a plugin to enable storage compression (see this article and this lib for examples).

ocombe avatar Dec 17 '14 10:12 ocombe

When I was using local storage directly and before I found angular-localforage I was using that compression. Worked very well, but there was a small slow down.

It good 2.9 mb of data down to 0.16mb. So a huge difference!

rpannell avatar Dec 17 '14 19:12 rpannell

Wow that's huge, it could really be a good feature. You were using "pako" ? The slow down is expected, and that's why it will be optional.

ocombe avatar Dec 18 '14 09:12 ocombe

+1 for lzstring

mavrick avatar Feb 17 '15 04:02 mavrick

+1 Is there any news on this one?

JobaDiniz avatar May 17 '15 21:05 JobaDiniz

Not much, I don't have a lot of free time for now, but if you want to try to do that and do a PR, feel free to do so :)

ocombe avatar May 17 '15 22:05 ocombe

Let's put this back in the queue for 1.4.0.

scotttrinh avatar Jun 27 '16 13:06 scotttrinh

+1 any updates on this issue?

siddo420 avatar Oct 23 '16 23:10 siddo420

nothing new to report, but it is definitely on the road map. PRs welcome!

scotttrinh avatar Oct 23 '16 23:10 scotttrinh

Quick question for those who would want to use this functionality: what about making a custom localForage driver that does this compression? That would keep our codebase cleaner by still just wrapping localForage and would help the upstream community. The downside is that we'd be subject to localForage's opinions and timeframes.

scotttrinh avatar Oct 24 '16 17:10 scotttrinh

Or maybe a separate compression decorator that just wraps the getItem/setItem calls to compress and decompress on the way in and out?

scotttrinh avatar Oct 24 '16 17:10 scotttrinh

Here is an example decorator using LZString:

http://plnkr.co/edit/r0tSMFNJwsbyUdLT35Or?p=preview

Not cut-n-paste production ready, but is a good starting point for those wishing to do this. Maybe we can just document this pattern and be done with it?

scotttrinh avatar Oct 24 '16 20:10 scotttrinh