Gathering detailed insights and metrics for @prantlf/zip-dir
Gathering detailed insights and metrics for @prantlf/zip-dir
Gathering detailed insights and metrics for @prantlf/zip-dir
Gathering detailed insights and metrics for @prantlf/zip-dir
Zips up a directory and saves the zip archive to disk or returns as a buffer.
npm install @prantlf/zip-dir
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2 Stars
40 Commits
1 Watchers
5 Branches
1 Contributors
Updated on Oct 19, 2020
Latest Version
1.1.0
Package Id
@prantlf/zip-dir@1.1.0
Unpacked Size
10.48 kB
Size
4.13 kB
File Count
4
NPM Version
6.13.4
Node Version
10.19.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Zips up a directory and saves the zip archive to disk or returns as a buffer.
This fork enhances the original project with the following functionality:
jszip
and other packages.Promise
to notify about the finished work.rootPath
, comment
, compressionLevel
, omitEmptyDirs
and allowEmptyRoot
.$ npm install @prantlf/zip-dir
1var zipdir = require('@prantlf/zip-dir'); 2 3// `buffer` is the buffer of the zipped file 4var buffer = await zipdir('/path/to/be/zipped'); 5 6zipdir('/path/to/be/zipped', function (err, buffer) { 7 // `buffer` is the buffer of the zipped file 8}); 9 10zipdir('/path/to/be/zipped', { rootPath: 'archived' }, function (err, buffer) { 11 // Files and folders from `/path/to/be/zipped will` 12 // be stored in `archived/` in the output zip file. 13}); 14 15zipdir('/path/to/be/zipped', { saveTo: '~/myzip.zip' }, function (err, buffer) { 16 // `buffer` is the buffer of the zipped file 17 // And the buffer was saved to `~/myzip.zip` 18}); 19 20// Use a filter option to prevent zipping other zip files! 21// Keep in mind you have to allow a directory to descend into! 22zipdir('/path/to/be/zipped', { filter: (path, stat) => !/\.zip$/.test(path) }, function (err, buffer) { 23 24}); 25 26// Use an `each` option to call a function everytime a file is added, and receives the path 27zipdir('/path/to/be/zipped', { each: path => console.log(p, "added!"), function (err, buffer) { 28 29}); 30
var zipdir = require('@prantlf/zip-dir');
Zips up dirPath
recursively preserving directory structure and returns
the compressed buffer on success. If the callback
function is supplied, it will be called with (error, buffer)
once the zipdir
function is done. If not, the buffer or an error can be obtained from the returned promise. The callback
and the promise are mutually exclusive. If options
defined with a saveTo
path, then the callback and promise will be delayed until the buffer has also
been saved to disk.
rootPath
Folder path to create in the root of the zip file and place the input files and folder below it. Input files and folders will be placed directly to the zip file root by default.saveTo
A path to save the buffer to.filter
A function that is called for all items to determine whether or not they should be added to the zip buffer. Function is called with the fullPath
and a stats
object (fs.Stats). Return true to add the item; false otherwise. To include files within directories, directories must also pass this filter.each
A function that is called everytime a file or directory is added to the zip.comment
A comment to be stored to the zip file.compressionLevel
The level of compression to use. A number from 1 (best speed) and 9 (best compression). 6 is the default.omitEmptyDirs
Prevents empty directories from being included in the zip file. If the root folder to pack is empty, the whole operation will fail.allowEmptyRoot
Lets the empty root directory be included in the zip file, if theomitEmptyDirs
is set to true
.MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
27 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More