Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ismail-elkorchi/dir-archiver
Compress a whole directory (including subdirectories) into a zip file, with options to exclude specific files, or directories.
https://github.com/ismail-elkorchi/dir-archiver
archive archiver compression directory folder nodejs npm zip
Last synced: about 7 hours ago
JSON representation
Compress a whole directory (including subdirectories) into a zip file, with options to exclude specific files, or directories.
- Host: GitHub
- URL: https://github.com/ismail-elkorchi/dir-archiver
- Owner: Ismail-elkorchi
- License: mit
- Created: 2020-05-11T09:05:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-30T04:04:45.000Z (5 months ago)
- Last Synced: 2024-09-19T10:50:26.221Z (about 2 months ago)
- Topics: archive, archiver, compression, directory, folder, nodejs, npm, zip
- Language: JavaScript
- Homepage:
- Size: 210 KB
- Stars: 14
- Watchers: 2
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![npm][npm-image]][npm-url] [![license][license-image]][license-url]
[![changelog][changelog-image]][changelog-url]# Dir Archiver
Compress a whole directory (including subdirectories) into a zip file, with options to exclude specific files, or directories.# Installation
```sh
$ npm install dir-archiver
```# Usage
## API
```javascript
// Require modules.
var DirArchiver = require('dir-archiver');// Create an array with the files and directories to exclude.
const excludes = ['directory_name', 'file.extension'];/**
* Create a dir-archiver object.
* @param {string} directoryPath - The path of the folder to archive.
* @param {string} zipPath - The path of the zip file to create.
* @param {Boolean} includeBaseDirectory - Includes a base directory at the root of the archive.
* For example, if the root folder of your project is named "your-project", setting
* includeBaseDirectory to true will create an archive that includes this base directory.
* If this option is set to false the archive created will unzip its content to
* the current directory.
* @param {array} excludes - A list with the names of the files and folders to exclude.
*/
var archive = new DirArchiver('path/to/directory', 'path/to/desination/zipfile.zip', true, excludes);// Create the zip file.
archive.createZip();
```
## Command Line Interface```sh
Usage: dir-archiver --src --dest .zip --includebasedir true|false --exclude folder-name file-name.extentionOptions:
--src The path of the folder to archive. [string][required]
--dest The path of the zip file to create. [string][required]
--includebasedir Includes a base directory at the root of the archive.
For example, if the root folder of your project is named
"your-project", setting this option to true will create
an archive that includes this base directory.
If this option is set to false the archive created will
unzip its content to the current directory. [bool]
--exclude A list with the names of the files and folders to exclude. [array]
```[changelog-image]: https://img.shields.io/badge/changelog-md-blue.svg?style=flat-square
[changelog-url]: CHANGELOG.md
[license-image]: https://img.shields.io/npm/l/dir-archiver.svg?style=flat-square
[license-url]: LICENSE
[npm-image]: https://img.shields.io/npm/v/dir-archiver.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/dir-archiver