Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bestzip

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bestzip - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

22

lib/bestzip.js

@@ -8,2 +8,3 @@ // creates a zip file using either the native `zip` command if avaliable,

var fs = require('fs');
var pathUtil = require('path');

@@ -40,2 +41,9 @@ var archiver = require('archiver');

function nodeZip(dest, source, done) {
var zipDest = source;// this "dest" is the filename inside of the zip
var basename = pathUtil.basename(source);
if (basename == '*') {
source = source.substr(0, source.length-1);
zipDest = '/';
}
var output = fs.createWriteStream(dest);

@@ -48,6 +56,12 @@ var archive = archiver('zip');

archive.pipe(output);
archive.bulk([
{expand: true, cwd: source, src: ['**'], dest: source} // this "dest" is the filename inside of the zip, not the name of the zip
]);
archive.finalize();
fs.stat(source, function(err, stats) {
if (stats.isDirectory()) {
archive.bulk([
{expand: true, cwd: source, src: ['**'], dest: zipDest}
]);
} else if (stats.isFile()) {
archive.file(source, {name: basename, stats: stats});
}
archive.finalize();
});
}

@@ -54,0 +68,0 @@

2

package.json
{
"name": "bestzip",
"version": "1.0.0",
"version": "1.0.1",
"description": "Uses OS zip command if avaliable (for better performance and speed) or node.js version if there is no system command avaliable. Can be called via node or command line.",

@@ -5,0 +5,0 @@ "main": "lib/bestzip.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc