Comparing version 2.2.0 to 2.2.1
@@ -13,2 +13,7 @@ #!/usr/bin/env node | ||
}) | ||
.option("level", { | ||
describe: "Level of compression", | ||
type: "number", | ||
default: -1, | ||
}) | ||
.demand(2).argv; | ||
@@ -19,2 +24,7 @@ | ||
if (argv.level < -1 || argv.level > 9) { | ||
console.error("Invalid compression level, must be >= 0 and <= 9"); | ||
process.exit(1); | ||
} | ||
console.log("Writing %s to %s...", source.join(", "), destination); | ||
@@ -31,3 +41,4 @@ | ||
destination: destination, | ||
verbose: argv.verbose, | ||
verbose: !!argv.verbose, | ||
level: argv.level, | ||
}) | ||
@@ -34,0 +45,0 @@ .then(function () { |
@@ -74,2 +74,11 @@ // creates a zip file using either the native `zip` command if available, | ||
); | ||
if ( | ||
typeof options.level == "number" && | ||
!isNaN(options.level) && | ||
options.level >= 0 && | ||
options.level <= 9 | ||
) { | ||
args.splice(0, 0, "-" + options.level.toString()); | ||
} | ||
const zipProcess = cp.spawn(command, args, { | ||
@@ -103,3 +112,5 @@ stdio: "inherit", | ||
const output = fs.createWriteStream(path.resolve(cwd, options.destination)); | ||
const archive = archiver("zip"); | ||
const archive = archiver("zip", { | ||
zlib: { level: options.level }, | ||
}); | ||
@@ -106,0 +117,0 @@ output.on("close", resolve); |
{ | ||
"name": "bestzip", | ||
"version": "2.2.0", | ||
"version": "2.2.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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11629
207