Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript: Decompress / inflate /unzip /ungzip strings [closed]

I'm looking for JavaScript implementation of string inflating algorithms. I want to compress on the server side (Java), and decompress on the client side (JavaScript).

I've found:

unzip strings in javascript
That one is marked as answered with an answer for different problem. Other answers are also for something else (unzipping files in ZIP format).

JavaScript inflate implementation (possibly FF 3.6 only)
This is closest to what I need. However I'd like to have some alternatives.

Suggestions?
Thanks, Ondra

Update: I have quite a specific use case, please don't answer "Don't do that in JavaScript." I am writing an "offline" reporting tool (once generated, it's put to a static store) and deflating may save megabytes for a single report. I am constrained by other apps so I can't store it as a zip file.

like image 375
Ondra Žižka Avatar asked Feb 02 '11 13:02

Ondra Žižka


2 Answers

Take a look at this Stack Overflow question, the answers there contains references to multiple compressing engines implemented in javascript. Most of these are based on LZ77.

like image 180
Sean Kinsey Avatar answered Sep 29 '22 09:09

Sean Kinsey


I don't know how you'd like that, but I like these implementations:

The first is fastest than second, We can usually ensure a fast server, however we don't know the performance of the client machine. Therefore I recommend you choose js-deflate and adjust your java (server side) to inflate.

https://github.com/dankogai/js-deflate

http://code.google.com/p/gzipjs/

like image 31
Gustavo Costa De Oliveira Avatar answered Sep 29 '22 10:09

Gustavo Costa De Oliveira