archiverjs
v1.0.10
Published
Simple Node.js library for compressing and extracting .tar.gz, .zip, and .7z archives
Downloads
40
Maintainers
Readme
Summary
ArchiverJS is a lightweight Node.js library for compressing and extracting directories with support for .tar.gz, .zip, and .7z formats, powered by a promise-based API for seamless async/await usage (docs.npmjs.com). It aims to simplify archive workflows in Node.js projects by providing a single, intuitive interface for multiple archive types (Bits and Pieces).
Installation
Install ArchiverJS via npm:
npm install archiverjs --saveThis adds ArchiverJS to your project’s dependencies (docs.npmjs.com).
Usage
Import and use the compress and extract functions with async/await:
import { compress, extract } from 'archiverjs';
await compress('mydir'); // create mydir.tar.gz
await compress('mydir', 'mydir.tar.gz');
await compress('mydir', 'mydir.zip');
await compress('mydir', 'mydir.7z');
await extract('mydir.tar.gz');
await extract('mydir.zip');
await extract('mydir.7z');This pattern follows typical Node.js module usage guidelines for clarity and consistency (Bits and Pieces).
Features
- Promise-based API for easy async/await integration (Bits and Pieces)
- Multi-format support:
.tar.gz,.zip, and.7z(Bits and Pieces) - No external CLI dependencies: all operations run via native Node.js packages (Bits and Pieces)
API
compress(inputDir, outputPath)
Compresses the specified directory (inputDir) into the archive file at outputPath. Supported extensions: .tar.gz, .zip, .7z (arXiv).
extract(archivePath, destDir = '.')
Extracts the given archive (archivePath) into destDir (defaults to current directory). Automatically detects and handles .tar.gz, .zip, and .7z formats (arXiv).
Contributing
Contributions, bug reports, and feature requests are welcome via GitHub pull requests or issues: https://github.com/GitHub30/archiverjs/issues (Bits and Pieces).
Deployment
Open GitHub Codespaces
npm adduser
npm publish --access publicLicense
This project is licensed under the MIT License. See LICENSE for details (docs.npmjs.com).
