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

bestzip

Package Overview
Dependencies
Maintainers
3
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 2.1.7 to 2.2.0

8

bin/cli.js

@@ -11,3 +11,3 @@ #!/usr/bin/env node

describe: "Force use of node.js or native zip methods",
choices: ["node", "native"]
choices: ["node", "native"],
})

@@ -30,10 +30,10 @@ .demand(2).argv;

destination: destination,
verbose: argv.verbose
verbose: argv.verbose,
})
.then(function() {
.then(function () {
console.log("zipped!");
})
.catch(function(err) {
.catch(function (err) {
console.error(err);
process.exit(1);
});

@@ -26,3 +26,3 @@ // creates a zip file using either the native `zip` command if available,

noext: true, // no (a|b)
nobrace: true // no {a,b}
nobrace: true, // no {a,b}
};

@@ -56,3 +56,3 @@ // first handle arrays

function walkDir(fullPath) {
const files = fs.readdirSync(fullPath).map(f => {
const files = fs.readdirSync(fullPath).map((f) => {
const filePath = path.join(fullPath, f);

@@ -68,3 +68,3 @@ const stats = fs.statSync(filePath);

const nativeZip = options =>
const nativeZip = (options) =>
new Promise((resolve, reject) => {

@@ -79,6 +79,6 @@ const cwd = options.cwd || process.cwd();

stdio: "inherit",
cwd
cwd,
});
zipProcess.on("error", reject);
zipProcess.on("close", exitCode => {
zipProcess.on("close", (exitCode) => {
if (exitCode === 0) {

@@ -102,3 +102,3 @@ resolve();

// based on http://stackoverflow.com/questions/15641243/need-to-zip-an-entire-directory-using-node-js/18775083#18775083
const nodeZip = options =>
const nodeZip = (options) =>
new Promise((resolve, reject) => {

@@ -117,3 +117,3 @@ const cwd = options.cwd || process.cwd();

const destPath = source;
fs.stat(fullPath, function(err, stats) {
fs.stat(fullPath, function (err, stats) {
if (err) {

@@ -125,6 +125,6 @@ return next(err);

const files = walkDir(fullPath);
files.forEach(f => {
files.forEach((f) => {
const subPath = f.substring(fullPath.length);
archive.file(f, {
name: destPath + subPath
name: destPath + subPath,
});

@@ -143,3 +143,3 @@ });

}
async.forEach(expandedSources, addSource, err => {
async.forEach(expandedSources, addSource, (err) => {
if (err) {

@@ -158,3 +158,3 @@ return reject(err);

source: arguments[1],
destination: arguments[0]
destination: arguments[0],
};

@@ -161,0 +161,0 @@ }

{
"name": "bestzip",
"version": "2.1.7",
"version": "2.2.0",
"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.",

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

},
"engines": {
"node": ">=10"
},
"scripts": {

@@ -25,22 +28,21 @@ "lint": "eslint .",

"dependencies": {
"archiver": "^4.0.2",
"archiver": "^5.3.0",
"async": "^3.2.0",
"glob": "^7.1.3",
"which": "^1.3.1",
"yargs": "^13.2.4"
"glob": "^7.1.6",
"which": "^2.0.2",
"yargs": "^16.2.0"
},
"devDependencies": {
"chai": "^4.2.0",
"chai": "^4.3.4",
"command-line-test": "^1.0.10",
"eslint": "^5.6.1",
"eslint-config-prettier": "^4.2.0",
"eslint-plugin-prettier": "^3.1.0",
"fs": "0.0.1-security",
"jest": "^24.8.0",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"klaw-sync": "^6.0.0",
"prettier": "^1.14.3",
"regenerator-runtime": "^0.13.2",
"rimraf": "^2.6.2",
"unzip-stream": "^0.3.0"
"prettier": "^2.2.1",
"regenerator-runtime": "^0.13.7",
"rimraf": "^3.0.2",
"unzip-stream": "^0.3.1"
}
}
# bestzip
[![Build status](https://travis-ci.org/nfriedly/node-bestzip.svg?branch=master)](https://travis-ci.org/nfriedly/node-bestzip)
[![npm version](https://badge.fury.io/js/bestzip.svg)](https://www.npmjs.com/package/bestzip)
[![npm downloads](https://img.shields.io/npm/dm/bestzip)](https://www.npmjs.com/package/bestzip)

@@ -8,7 +10,8 @@ This module provides a `bestzip` command that calls the native `zip` command if available and otherwise falls back to a

The native `zip` method on macOS is significantly faster and more as efficient than the Node.js version, but Windows has no
native `zip` command. This module provides the best of both worlds.
The `--recurse-directories` (`-r`) option is automatically enabled.
## Why?
The native `zip` command on GNU/Linux and macOS is significantly faster and creates moderately smaller .zip files than the Node.js version included here, but Windows has no built-in `zip` command. This module provides the best of both worlds, and allows for easier cross-platform scripting.
## Global command line usage

@@ -63,6 +66,4 @@

The directory structure in the .zip is going to match your input files. To have greater or fewer levels of directories.
The directory structure in the .zip is going to match your input files, but the exact details depend on how the command is called. For example:
For example:
`bestzip build.zip build/*`

@@ -78,2 +79,4 @@

*Note: some tools, including the Archive Utility built into macOS, will automatically create a top-level folder to group everything together when extracting a .zip archive that contains multiple top-level files.*
When using the programmatic API, the same effect may be achieved by passing in the `cwd` option.

@@ -83,3 +86,3 @@

Wildcards ('*') ignore dotfiles.
Wildcards (`*`) ignore dotfiles.

@@ -86,0 +89,0 @@ * To include a dotfile, either include the directory it's in (`folder/`) or include it by name (`folder/.dotfile)`

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