📂
File System3M+/wkMIT

adm-zip

adm-zip is a pure JavaScript library for reading, creating, and extracting ZIP archives in Node.js without native dependencies. The library provides a simple, s

Installation

npm
npm install adm-zip
yarn
yarn add adm-zip
pnpm
pnpm add adm-zip

Import

ESM
import AdmZip from 'adm-zip';

Quick Example

usage
import AdmZip from 'adm-zip';

// Read existing ZIP
const zip = new AdmZip('archive.zip');
const entries = zip.getEntries();
entries.forEach((e) => console.log(e.entryName));
zip.extractAllTo('output/', true);

// Create new ZIP
const newZip = new AdmZip();
newZip.addLocalFile('README.md');
newZip.addLocalFolder('src/', 'source/');
newZip.writeZip('new-archive.zip');

About adm-zip

adm-zip is a pure JavaScript library for reading, creating, and extracting ZIP archives in Node.js without native dependencies. The library provides a simple, synchronous API for working with ZIP files — read entries, extract files to disk or memory, add files and directories, update existing archives, and create new ZIP files from scratch. adm-zip reads the entire ZIP file into memory for manipulation, which makes it simple to use but less suitable for very large archives where Archiver's streaming approach is preferred. The API provides methods like getEntries() for listing archive contents, readAsText() and readFile() for reading specific entries, extractAllTo() for extracting the entire archive, addLocalFile() for adding files, and writeZip() for saving changes. Each entry includes metadata like filename, size, compressed size, comment, and modification date. adm-zip supports ZIP64 for files larger than 4GB, password-protected archives, and Unicode filenames. The library is particularly useful for quick ZIP operations in scripts, test fixtures, and applications that need to inspect or modify ZIP contents without streaming complexity. adm-zip works well for moderate-sized archives where the convenience of in-memory manipulation outweighs memory considerations.

Quick Facts

Packageadm-zip
CategoryFile System
Weekly Downloads3M+
LicenseMIT
Installnpm install adm-zip

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.