jszipJS 压缩库
jszip 是一个 JavaScript 库,可直接在浏览器上创建 zip 压缩档。
在线演示:http://viralpatel.net/blogs/demo/js/create-zip-file-javascript/
示例代码:
<HTML> <HEAD> <scripttype="text/javascript"src="jszip.js"></script> </HEAD> <BODY> <inputtype="button"onclick="create_zip()"value="Create Zip"/> </BODY> <SCRIPT> function create_zip() { var zip = new JSZip(); zip.add("hello1.txt", "Hello First World\n"); zip.add("hello2.txt", "Hello Second World\n"); content = zip.generate(); location.href="data:application/zip;base64," + content; } </SCRIPT> </HTML>
评论