Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a library available for compression in Javascript [closed]

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.

like image 661
gkaykck Avatar asked Feb 27 '11 22:02

gkaykck


2 Answers

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.

like image 77
Chris Farmiloe Avatar answered Oct 05 '22 23:10

Chris Farmiloe


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

like image 28
luksch Avatar answered Oct 06 '22 00:10

luksch