I am looking for sending data from server in a compressed format to client(with ajax requests), and than decompress that data with a browser? Is there a library for this?
I am not looking for compressing javascript files!
EDIT: I think question was not clear enough, i don't want to compress html files, i want to store some compressed LZMA files or any other compression format on server(like an obj file), and then i need to decompress them after i got it with AJAX. Not simultaneous compression/decompression with gzip. Opening already zipeed files after getting them with Javascript.
Your web-server (and the browser) should be capable of handling this transparently using gzip. How this is setup will depend on which server you are using.
Checkout mod_deflate in apache or enabling gzip in nginx.
The browser will automatically decompress the data before it reaches your XHR handler and you can be safe in the knowledge that your data was compressed as much as possible in transit.
I know, this is a very late answer, but I found this an interesting alternative: http://pieroxy.net/blog/pages/lz-string/index.html It also has implementations in other languages!
And my favorite right now is pako. It is really blazing fast and easy to use and compatible to the well known zlib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With