Socket
Socket
Sign inDemoInstall

zip-dir

Package Overview
Dependencies
3
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

28

index.js
var fs = require('fs');
var path = require('path');
var asyncLib = require('async');
// Use local version of JSZip, as the version in `npm` is a fork

@@ -11,3 +13,2 @@ // and not up to date, and failing on v0.8, so this is an unfortunate

var maxOpenFiles = 500;
var openFiles = 0;

@@ -66,2 +67,12 @@ module.exports = function zipWrite (rootDir, options, callback) {

var fileQueue = asyncLib.queue(function (task, callback) {
fs.readFile(task.fullPath, function (err, data) {
if (options.each) {
options.each(path.join(task.dir, task.file));
}
folders[task.dir].file(task.file, data);
callback(err);
});
}, maxOpenFiles);
function addItem (fullPath, cb) {

@@ -82,16 +93,3 @@ fs.stat(fullPath, function (err, stat) {

} else {
if (openFiles < maxOpenFiles) {
openFiles++;
fs.readFile(fullPath, function (err, data) {
if (options.each) {
options.each(path.join(dir, file));
}
folders[dir].file(file, data);
openFiles--;
cb(err);
});
}
else {
addItem(fullPath, cb);
}
fileQueue.push({ fullPath: fullPath, dir: dir, file: file }, cb);
}

@@ -98,0 +96,0 @@ });

{
"name": "zip-dir",
"version": "1.0.1",
"version": "1.0.2",
"description": "Zips up directories into buffers or saves zipped files to disk",

@@ -23,4 +23,5 @@ "main": "index.js",

"dependencies": {
"jszip": "^2.4.0"
"jszip": "^2.4.0",
"async": "^1.5.2"
}
}
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