开发者

gunzip in javascript

An API returns large resultsets and I was wishing that I could gzip it in PHP but I wouldn't know how to gunzip it in Javascript. Is there some sort of library that is capable of this in Javascript? I was searching the net and found some stuff but c开发者_StackOverflow社区ouldn't quite figure out how to make use of it. So, if anybody has ever dealt with this before, advise is highly appreciated.

(The API response is worth about 1MB)


Usually compression of HTTP responses is done by either a proxy or a web server. You should be able to configure Apache to do this for you. See the documentation for mod_deflate for more information.

In terms of unzipping in JavaScript, this is a non-issue. Provided that the HTTP response contains the correct header information. (Content-Encoding: gzip) the browser will handle the unzipping for you.


Have the web server do it. Set the HTTP header to accept gzip when you send your request.


The web server and browser can usually handle the compression transparently, without needing php and javascript support. For example, a google search turned up: http://forums.digitalpoint.com/showthread.php?t=43

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜