Permalink
Fetching contributors…
Cannot retrieve contributors at this time
172 lines (155 sloc) 4.2 KB
---
title: JSZip
layout: default
section: main
---
<div class="row">
<div class="col-md-5">
JSZip is a javascript library for creating, reading and editing .zip files, with a
lovely and simple API.
</div>
<div class="col-md-7">
<p>
<strong>Current version</strong> : v3.1.4
</p>
<p>
<strong>License</strong> : JSZip is dual-licensed. You may use it under the
MIT license <em>or</em> the GPLv3 license. See
<a href="https://github.com/Stuk/jszip/blob/master/LICENSE.markdown">LICENSE.markdown</a>.
</p>
</div>
<div class="row">
<div class="col-md-5">
<h3>Example</h3>
<script type="text/javascript">
imgData = "R0lGODdhBQAFAIACAAAAAP/eACwAAAAABQAFAAACCIwPkWerClIBADs=";
jQuery(function($) {
if(!JSZip.support.blob) {
$("#demo-not-supported").removeClass("hidden");
$("#demo").hide();
return;
}
$("#demo").click(function () {
try {
eval($("#demo-code").val());
$("#status")
.removeClass()
.addClass("text-success")
.text("Done!");
}
catch (e) {
$("#status")
.removeClass()
.addClass("text-danger")
.text(e);
}
});
});
</script>
<textarea class="form-control" id="demo-code" rows="9" spellcheck="false">
var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
var img = zip.folder("images");
img.file("smile.gif", imgData, {base64: true});
zip.generateAsync({type:"blob"})
.then(function(content) {
// see FileSaver.js
saveAs(content, "example.zip");
});</textarea>
<button id="demo" class="btn btn-primary">Run!</button>
<span id="status"></span>
<div id="demo-not-supported" class="alert alert-danger hidden">
This browser doesn't support blobs, this demo won't work :(
See <a href="{{site.baseurl}}/documentation/howto/write_zip.html" class="alert-link">here for more info</a>.
</div>
</div>
<div class="col-md-7">
<h3>Installation</h3>
<p>
<strong>With npm</strong> : <code>npm install jszip</code>
</p>
<p>
<strong>With bower</strong> : <code>bower install Stuk/jszip</code>
</p>
<p>
<strong>With component</strong> : <code>component install Stuk/jszip</code>
</p>
<p>
<strong>Manually</strong> : <a href="http://github.com/Stuk/jszip/zipball/master">download JSZip</a>
and include the file <code>dist/jszip.js</code> or <code>dist/jszip.min.js</code>
</p>
<br>
<p>
Installed ? Great ! You can now check our
<a href="{{site.baseurl}}/documentation/examples.html">guides and examples !</a>
</p>
</div>
</div>
<h3>Support</h3>
<table class="browser_support">
<tr>
<th class="support_op">Opera</th>
<th class="support_ff">Firefox</th>
<th class="support_sf">Safari</th>
<th class="support_cr">Chrome</th>
<th class="support_ie">Internet Explorer</th>
<th class="support_nd">Node.js</th>
</tr>
<tr>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Tested with the latest version</td>
<td>Tested with 3.0 / 3.6 / latest version</td>
<td>Tested with the latest version</td>
<td>Tested with the latest version</td>
<td>Tested with IE 6 / 7 / 8 / 9 / 10</td>
<td>Tested with node.js 0.10 / latest version</td>
</tr>
</table>
<h3>Getting help</h3>
<p>
Having trouble ? We'd like to help !
</p>
<ul>
<li>
Try the <a href="{{site.baseurl}}/documentation/faq.html">FAQ</a>, it has
answers to common questions.
</li>
<li>
If you're looking for informations about a specific method, try the
<a href="{{site.baseurl}}/documentation/api_jszip.html">documentation</a>.
</li>
<li>
Check the
<a href="{{site.baseurl}}/documentation/examples.html">examples</a>.
</li>
<li>
Report bugs in our
<a href="https://github.com/Stuk/jszip/issues">Bug tracker</a>.
</li>
</ul>
<h3>Test status</h3>
<dl class="dl-horizontal">
<dt>Travis build :</dt>
<dd>
<a href="http://travis-ci.org/Stuk/jszip">
<img src="https://api.travis-ci.org/Stuk/jszip.svg?branch=master" alt="" />
</a>
</dd>
<dt>Saucelabs build :</dt>
<dd>
<a href="https://saucelabs.com/u/jszip">
<img src="https://saucelabs.com/browser-matrix/jszip.svg" alt="" />
</a>
</dd>
<dt>Live tests :</dt>
<dd>
<a href="{{site.baseurl}}/test/">See for yourself !</a>
</dd>
</dl>