Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
zip-dir
Advanced tools
Readme
Zips up a directory and saves the zip to disk or returns as a buffer.
$ npm install zip-dir
var zipdir = require('zip-dir');
// `buffer` is the buffer of the zipped file
var buffer = await zipdir('/path/to/be/zipped');
zipdir('/path/to/be/zipped', function (err, buffer) {
// `buffer` is the buffer of the zipped file
});
zipdir('/path/to/be/zipped', { saveTo: '~/myzip.zip' }, function (err, buffer) {
// `buffer` is the buffer of the zipped file
// And the buffer was saved to `~/myzip.zip`
});
// Use a filter option to prevent zipping other zip files!
// Keep in mind you have to allow a directory to descend into!
zipdir('/path/to/be/zipped', { filter: (path, stat) => !/\.zip$/.test(path) }, function (err, buffer) {
});
// Use an `each` option to call a function everytime a file is added, and receives the path
zipdir('/path/to/be/zipped', { each: path => console.log(p, "added!"), function (err, buffer) {
});
var zipdir = require('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.
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.MIT
FAQs
Zips up directories into buffers or saves zipped files to disk
The npm package zip-dir receives a total of 65,433 weekly downloads. As such, zip-dir popularity was classified as popular.
We found that zip-dir demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.