Socket
Socket
Sign inDemoInstall

zip-dir

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    zip-dir

Zips up directories into buffers or saves zipped files to disk


Version published
Maintainers
1
Install size
140 kB
Created

Readme

Source

zip-dir

Zips up a directory and saves the zip to disk or returns as a buffer.

Build Status

example

var zipdir = require('zip-dir');

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`
});

methods

var zipdir = require('zip-dir');

zipdir(dirPath, [options], callback)

Zips up dirPath recursively preserving directory structure and returns the compressed buffer into callback on success. If savePath defined, the buffer will also be saved to disk at that path, with the callback also firing upon completion with the buffer.

Options
  • 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.

install

$ npm install zip-dir

license

MIT

FAQs

Last updated on 09 Jul 2014

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc