This library depends on the Promise, the TypedArray, the Streams APIs and these ones optionally:
This library works fully with the latest versions of Chrome, Firefox, Safari, Microsoft Edge, Node.js, Deno, and Bun.
Warning: Make sure that the code is parsed in UTF-8, e.g. served with the HTTP header
"Content-Type: application/javascript; charset=utf-8", otherwise filenames might be corrupted
when reading zip files.
You can get the code via:
import * as zip from "jsr:@zip-js/zip-js";
$ npm install @zip.js/zip.js
import * as zip from "@zip.js/zip.js";
const zip = require("@zip.js/zip.js");
Note: import * as zip imports the whole library. Import named identifiers
instead, e.g. import { ZipReader, BlobReader, TextWriter } from "@zip.js/zip.js";, to let your
bundler remove the code you do not use, e.g. the whole write path if you only read zip files. See the
Bundle size section for the measured
sizes and the smaller entry points.
You can also install manually the library by adding zip.min.js from the
/dist
directory in your project. Then, include zip.min.jsin your HTML page:
require(["/library_path/zip.min.js"], zip => {
// ...
});
<meta charset="utf-8"> <!-- make sure the script is parsed in UTF-8 -->
...
<script type="text/javascript" src="/library_path/zip.min.js"></script>
<script>
// the zip API is in the `zip` global variable
// ...
</script>