Archiver
A streaming Node.js library for generating ZIP and TAR archives on the fly
Repository Health
Technical Analysis
Archiver is a battle-tested Node.js library that provides a unified, streaming interface for generating archive files. It ships with out-of-the-box support for the ZIP and TAR formats and lets you append data from files, strings, buffers, readable streams, glob patterns, and entire directories, all while piping the compressed output directly to any writable destination.
Built on top of Node’s native stream primitives, Archiver keeps memory usage low even for very large archives by processing entries through an internal work queue rather than buffering everything up front. With over 31 million weekly downloads it is one of the most widely relied-upon packaging libraries in the JavaScript ecosystem.
What You Get
- A single streaming API that produces both ZIP and TAR (including gzip-compressed .tar.gz) archives
- Flexible entry sources: files, strings, buffers, readable streams, glob patterns, and recursive directories
- Fine-grained per-entry control over names, dates, permissions, path prefixes, and symlink handling
- Progress and lifecycle events (entry, progress, warning, error) plus a byte pointer for tracking output size
- Low, predictable memory usage via an internal concurrency-limited work queue
Common Use Cases
- Generating downloadable ZIP bundles on the fly in an Express or other HTTP server response
- Packaging build artifacts, logs, or backups into TAR/TAR.GZ files from a Node script
- Bundling user-uploaded files or exported data into a single archive for download
- Creating deployment or release archives as part of a CI/CD pipeline
Under The Hood
Architecture — Archiver centers on lib/core.js, an 851-line Archiver class extending readable-stream’s Transform. Format-specific classes in index.js (ZipArchive, TarArchive, JsonArchive) subclass the core and wire in a pluggable format engine from lib/plugins/ (zip.js delegates to zip-stream, tar.js to tar-stream). Appended entries flow through two async work queues — a stat queue (default concurrency 4) that resolves filesystem metadata and a serial processing queue that feeds each normalized entry into the format module, whose output is piped back through the Transform, keeping memory flat and honoring highWaterMark backpressure. finalize() drains the queues and closes the underlying module.
Tech Stack — Pure JavaScript ES modules targeting Node >=18. Runtime dependencies are small, focused packages: zip-stream and tar-stream for format encoding, readable-stream for stream primitives, async for the work queues, readdir-glob/normalize-path/lazystream for directory and glob traversal, buffer-crc32 and is-stream as helpers. Tests use Mocha with Chai; docs are generated via JSDoc.
Code Quality — Well-structured with clear separation between the streaming core, the error module, utilities, and per-format plugins. Errors are centralized in lib/error.js as a coded ArchiverError with a fixed table of validation messages, and input validation is explicit throughout the append path. A substantial test suite (~710 lines across test/archiver.js and test/plugins.js) exercises the core and each format, and the public API is thoroughly documented with JSDoc annotations.
API Design — The API is highly ergonomic: instantiate a format class, attach error/warning handlers, pipe() to an output, then append(), file(), directory(), or glob() and call finalize(). Method names read naturally, options are consistent across formats, and switching output format is a one-line change. The README quick-start plus a directory of runnable examples make the getting-started path short with minimal boilerplate.
Used by 40 apps in this directory
ai-toolkit
AI Development · AI Design Tools
An all-in-one open-source training suite for finetuning diffusion models—FLUX, SDXL, Wan video, and audio—on consumer GPU hardware via CLI or web UI.
BillionMail
Marketing
Self-hosted email server and marketing platform that gives you unlimited sending, full deliverability control, and AI-assisted campaigns without monthly fees.
Blinko
Knowledge Management · Note Taking
A self-hosted, AI-powered card note-taking tool that lets you capture fleeting thoughts instantly and retrieve them with natural language search.
Budibase
Low Code Platforms · No Code Platforms
Build AI agents, automations, and internal apps on a single open-source platform with full self-hosting control.
Cherry Studio
AI Assistants
All-in-one AI desktop client with 300+ assistants and multi-model support
Cline
AI Code Assistants
An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.
Coder
Devops · Developer Tools · Code Editors
Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.
CodeSandbox
Code Editors · Developer Tools
Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.
Convex Backend
Developer Tools · Databases
Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.