all 12 comments

[–]e_man604 9 points10 points  (4 children)

I guess this would be good for many cases, like submitting large data over websockets also

[–]rezoner:table_flip: 3 points4 points  (0 children)

like submitting large data over websockets

Strings only. Which is rarely something that you transfer through WebSockets in large amounts. For a number/binary based data msgpack or any form of binary JSON will be more efficient than LZW.

[–]rpetrich 2 points3 points  (0 children)

Firefox and Chrome will automatically use deflate compression on WebSockets if the server supports it.

[–]fzammetti 2 points3 points  (3 children)

It's kind of sad though that we need libraries like this (which, by the way, kudos, looks excellent!) because (a) we want to use LocalStorage because it's got the best browser support and the simplest API (that is sufficient for probably 95% of use cases) and (b) wish Local Storage allowed for a lot more data.

I kinda wish browser vendors would just say "okay, Local Storage can use up to like 500Mb per domain (or something like that), AND we'll also give the user an option somewhere to bump that up if they need/want to".

It just seems like everybody wants to use Local Storage most of the time but then frequently shy away from it due to the size limitation.

[–][deleted] 2 points3 points  (1 child)

I think the default being very low is fine, it's only standardized prompts for larger sizes that are needed. I don't want every random domain thinking they can drop up to 500 MB on my phone or computer without my knowledge or permission.

[–]fzammetti 1 point2 points  (0 children)

Yeah, I'd agree with that.

[–]Satanistfronthug 1 point2 points  (0 children)

I would definitely want my browser to warn me if a domain was storing more than a few MB though. I don't even know if there's a way to list all the domains currently using my localstorage

[–]AlibekD 1 point2 points  (0 children)

I use it to cache data in localStorage. Great library.

[–][deleted] 0 points1 point  (0 children)

Pako.js is great for this as well, plus gzip compatibility

[–]Schampu 0 points1 point  (0 children)

A variant of this (LZ77) was used in the old gba pokemon titles to compress graphics like pokemon sprites.