These libraries provide tools for compressing and extracting ZIP files within JavaScript applications. adm-zip, archiver, and jszip are the core engines, while node-zip, zip-a-folder, and zip-local serve as wrappers or legacy alternatives. They differ significantly in execution model — synchronous, streaming, or asynchronous — and environment support, with some working only on servers and others running in browsers. Choosing the right one depends on whether you need to handle large files, support client-side users, or maintain legacy code.
These six packages handle ZIP compression in JavaScript, but they differ in how they run, where they work, and their maintenance status. Some are built for servers, others for browsers, and some are no longer safe to use. Let's compare how they tackle common tasks.
adm-zip works mostly in a synchronous way.
// adm-zip: Synchronous API
const AdmZip = require("adm-zip");
const zip = new AdmZip();
zip.addLocalFile("input.txt");
zip.writeZip("output.zip"); // Blocks here
archiver uses streams to handle data.
// archiver: Streaming API
const archiver = require("archiver");
const output = fs.createWriteStream("output.zip");
const archive = archiver("zip");
archive.pipe(output);
archive.file("input.txt", { name: "inside.txt" });
archive.finalize(); // Ends the stream
jszip relies on Promises and async code.
// jszip: Async/Promise API
const JSZip = require("jszip");
const zip = new JSZip();
zip.file("input.txt", "content");
zip.generateAsync({ type: "nodebuffer" }).then(function (content) {
// Handle result
});
node-zip uses a synchronous legacy model.
adm-zip.// node-zip: Deprecated Sync API
const Zip = require("node-zip");
const zip = new Zip();
zip.add("input.txt", "content");
const data = zip.generate({ type: "nodebuffer" }); // Legacy method
zip-a-folder wraps other tools with async functions.
// zip-a-folder: Async Wrapper
const zipFolder = require("zip-a-folder");
await zipFolder("src_folder", "output.zip"); // Returns Promise
zip-local provides a synchronous helper interface.
// zip-local: Sync Chain API
const zip = require("zip-local").sync;
zip.zip("input.txt").compress().save("output.zip"); // Sync chain
adm-zip runs only on Node.js servers.
// adm-zip: Node.js only
// Uses fs module internally
zip.addLocalFile("./path/on/server.txt");
archiver runs only on Node.js servers.
// archiver: Node.js only
// Requires fs.createWriteStream
archive.pipe(fs.createWriteStream("out.zip"));
jszip runs on both Node.js and browsers.
// jszip: Universal
// Works in browser console or Node
zip.file("hello.txt", "Hello World\n");
node-zip was designed for Node.js.
// node-zip: Node.js legacy
// No browser support
zip.add("file", "data");
zip-a-folder runs on Node.js servers.
// zip-a-folder: Node.js only
await zipFolder("/server/path", "out.zip");
zip-local runs on Node.js servers.
// zip-local: Node.js only
zip.zip("/server/path").save("out.zip");
adm-zip is actively maintained.
archiver is actively maintained.
jszip is actively maintained.
node-zip is officially deprecated.
zip-a-folder has limited maintenance.
zip-local has low activity.
adm-zip or jszip for long-term projects.| Package | Model | Environment | Status |
|---|---|---|---|
adm-zip | Sync | Node.js | ✅ Active |
archiver | Stream | Node.js | ✅ Active |
jszip | Async | Both | ✅ Active |
node-zip | Sync | Node.js | ❌ Deprecated |
zip-a-folder | Async | Node.js | ⚠️ Wrapper |
zip-local | Sync | Node.js | ⚠️ Low Activity |
jszip is the go-to for browsers — it works everywhere and handles async tasks well.
archiver is the best for servers — it streams data so you do not run out of memory.
adm-zip is good for simple scripts — it is easy to read and write quickly.
node-zip should be avoided — it is deprecated and unsafe for new work.
Final Thought: Pick jszip for universal needs, archiver for large server files, and adm-zip for quick synchronous tasks. Avoid the deprecated options to keep your project secure.
Choose adm-zip if you need a simple synchronous API for Node.js scripts that handle small to medium files. It is easy to read and requires minimal setup for basic zipping tasks. However, avoid it for large files because it loads everything into memory at once. It is best suited for build tools or backend utilities where blocking the thread is acceptable.
Choose archiver if you are building a Node.js server that needs to stream large files without running out of memory. It pipes data directly to disk or network streams efficiently. This makes it ideal for generating downloads on the fly or handling big datasets. It requires more setup than synchronous tools but offers better performance for heavy workloads.
Choose jszip if you need to create or read ZIP files inside a web browser or require non-blocking async code in Node.js. It is the only option here that works universally across environments. It handles data in memory using Promises, which keeps your application responsive. Use this for client-side exports or when you need to manipulate archive contents before saving.
Do not choose node-zip for any new project because it is officially deprecated and unmaintained. It lacks modern security patches and feature updates required for production use. Existing projects using it should plan a migration to jszip or adm-zip. Relying on this package introduces unnecessary risk to your software supply chain.
Choose zip-a-folder if you need a quick utility to compress an entire directory in Node.js without writing boilerplate code. It wraps underlying libraries to provide a simple Promise-based interface. This is useful for one-off scripts or deployment tasks where speed of development matters. For complex archive manipulation, prefer a core library like archiver instead.
Choose zip-local only if you are maintaining legacy code that already depends on its specific synchronous chain API. It offers a convenient way to zip and save in one line for Node.js environments. However, it has low maintenance activity compared to core alternatives. For new development, select adm-zip or jszip to ensure long-term support and security.
ADM-ZIP is a pure JavaScript implementation for zip data compression for NodeJS.
With npm do:
$ npm install adm-zip
Electron file system support described below.
The library allows you to:
There are no other nodeJS libraries that ADM-ZIP is dependent of
var AdmZip = require("adm-zip");
// reading archives
var zip = new AdmZip("./my_file.zip");
var password = "1234567890";
var zipEntries = zip.getEntries(); // an array of ZipEntry records - add password parameter if entries are password protected
zipEntries.forEach(function (zipEntry) {
console.log(zipEntry.toString()); // outputs zip entries information
if (zipEntry.entryName == "my_file.txt") {
console.log(zipEntry.getData().toString("utf8"));
}
});
// outputs the content of some_folder/my_file.txt
console.log(zip.readAsText("some_folder/my_file.txt"));
// extracts the specified file to the specified location
zip.extractEntryTo(/*entry name*/ "some_folder/my_file.txt", /*target path*/ "/home/me/tempfolder", /*maintainEntryPath*/ false, /*overwrite*/ true);
// extracts everything
zip.extractAllTo(/*target path*/ "/home/me/zipcontent/", /*overwrite*/ true);
// creating archives
var zip = new AdmZip();
// add file directly
var content = "inner content of the file";
zip.addFile("test.txt", Buffer.from(content, "utf8"), "entry comment goes here");
// add local file
zip.addLocalFile("/home/me/some_picture.png");
// get everything as a buffer
var willSendthis = zip.toBuffer();
// or write everything to disk
zip.writeZip(/*target file name*/ "/home/me/files.zip");
// ... more examples in the wiki
For more detailed information please check out the wiki.
ADM-ZIP has supported electron original-fs for years without any user interractions but it causes problem with bundlers like rollup etc. For continuing support original-fs or any other custom file system module. There is possible specify your module by fs option in ADM-ZIP constructor.
Example:
const AdmZip = require("adm-zip");
const OriginalFs = require("original-fs");
// reading archives
const zip = new AdmZip("./my_file.zip", { fs: OriginalFs });
.
.
.