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
Omnivore
Bookmarks Archiving · Knowledge Management · Note Taking
Self-hosted read-it-later platform with highlights, newsletters, PDFs, and seamless Obsidian and Logseq integration.
OneUptime
Monitoring
The complete open-source observability platform that replaces PagerDuty, Datadog, Sentry, and StatusPage with a single self-hostable system.
overleaf
Collaboration · Productivity
Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.
Papermark
Digital Signiture · File Storage
Open-source DocSend alternative with page-by-page analytics, secure data rooms, and custom domains for document sharing.
PeerTube
Social Media
A federated, ActivityPub-based video hosting platform built by Framasoft — self-hostable instances interconnect into a network with no vendor lock-in, P2P-assisted streaming, and no ads.
Penpot
Design Tools
Open-source design platform with GPU-accelerated canvas, native design tokens, and MCP-powered AI workflows for teams that ship fast.
Rocket.Chat
Team Chat
The secure, self-hosted team communications platform for organizations that cannot compromise on data sovereignty.
Silex
Design Tools · No Code Platforms
Free, open-source visual website builder that exports clean HTML/CSS — no lock-in, no subscription, host anywhere
SillyTavern
AI Assistants
The power-user LLM frontend that unifies dozens of AI backends with a rich scripting engine, immersive Visual Novel mode, and a thriving extension ecosystem.