unzip strings in javascript [closed]

ⅰ亾dé卋堺 提交于 2019-12-21 13:02:01

问题


Anyone knows a simple JavaScript library implementing the UNZIP algorithm? No disk-file access, only zip and unzip a string of values.

There are ActiveX, using WinZIP and other client dependent software for ZIP, written in JS. But no pure JavaScript algorithm implementation.

I would use it for displaying KMZ files in a HTML page with the GMap object (google maps). The KMZ file is just a zipped KML file. I want to unzip a KMZ file and feed the KML to GMap.


回答1:


No need to unzip the KMZ file as Google Maps absolutely understands it. You can check it, simply search for the URL where your KMZ file is located in the Google Maps web interface and it will show its content on the map.

Here is a demo.




回答2:


Perhaps ZipReader from Mozilla can be used for what you are after.

https://developer.mozilla.org/en/nsIZipReader




回答3:


DotNetZip has a COM interface, that can be accessed from Javascript. It has a stream-to-stream unzip capability, but I have never tried using that from Javascript.
Also I have never tried using the library in any way from within IE.




回答4:


kthoom implements unzip on a binary string: http://kthoom.googlecode.com/




回答5:


I know this is an old question with an accepted answer, but just for the sake of interesting information, I'll post another answer. I put together a javascript-only library to read and extract zip files from any browser. It does not require Mozilla's ZipReader nor any ActiveX (aside from XMLHttpRequest).

You can see a working example here:
http://cheeso.members.winisp.net/Unzip-Example.htm

And you can download the source code from here:
http://cheeso.members.winisp.net/examples.aspx#js



来源:https://stackoverflow.com/questions/902260/unzip-strings-in-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!