JavaScript压缩库 jszip
fmms
13年前
<p>jszip 是一个 JavaScript 库,可直接在浏览器上创建 zip 压缩档。</p> <p>在线演示:<a href="/misc/goto?guid=4959500605122929180" target="_blank">http://viralpatel.net/blogs/demo/js/create-zip-file-javascript/</a><br /> 演示代码:<br /> </p> <pre class="brush:html; toolbar: true; auto-links: false;">< HTML > < HEAD > < script type = "text/javascript" src = "jszip.js" ></ script > </ HEAD > < BODY > < input type = "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 ></pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326244361171" target="_blank">http://www.open-open.com/lib/view/home/1326244361171</a></p> <p></p>