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

brotli-cli

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brotli-cli - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

6

CHANGELOG.md

@@ -9,2 +9,8 @@ All notable changes to this project will be documented in this file.

## [1.0.3] - 2021-08-13
### Fixed
- crash when compressing empty files
### Dev
- dev dep upgrade
## [1.0.2] - 2021-07-09

@@ -11,0 +17,0 @@ ### Changed

29

dist/index.js

@@ -135,16 +135,27 @@ #!/usr/bin/env node

let p = readFile(file)
.then(buffer => brotli_1.compress(buffer, {
mode: modes.indexOf(argv.mode),
quality: argv.quality,
lgwin: argv.lgwin,
}))
.then((compressed) => {
.then(buffer => {
if (!buffer.length) {
return {
sourceLength: 0,
compressed: null,
};
}
return {
sourceLength: buffer.length,
compressed: brotli_1.compress(buffer, {
mode: modes.indexOf(argv.mode),
quality: argv.quality,
lgwin: argv.lgwin,
}),
};
})
.then(async ({ sourceLength, compressed }) => {
if (printToStdOut) {
process.stdout.write(compressed);
process.stdout.write(compressed !== null && compressed !== void 0 ? compressed : "");
return;
}
if (compressed == null) {
if (sourceLength && compressed == null) {
throw new TypeError("Empty response returned from brotli");
}
return writeFile(argv.br ? file + ".br" : file, compressed);
return writeFile(argv.br ? file + ".br" : file, compressed !== null && compressed !== void 0 ? compressed : "");
});

@@ -151,0 +162,0 @@ if (!argv.bail) {

{
"name": "brotli-cli",
"version": "1.0.2",
"version": "1.0.3",
"repository": "git@github.com:dzek69/brotli-cli.git",

@@ -61,2 +61,2 @@ "author": "Jacek Nowacki",

}
}
}

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

// yargs needs that unused expression
// eslint-disable-next-line max-len
// eslint-disable-next-line @typescript-eslint/no-unused-expressions,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-magic-numbers
// eslint-disable-next-line @typescript-eslint/no-unused-expressions,@typescript-eslint/no-magic-numbers
yargs(process.argv.slice(2))

@@ -178,18 +177,29 @@ .scriptName("brotli-cli")

let p = readFile(file)
.then(buffer => compress(buffer, {
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
mode: modes.indexOf(argv.mode) as 0 | 1 | 2,
quality: argv.quality as Quality,
lgwin: argv.lgwin,
}))
.then((compressed) => {
.then(buffer => {
if (!buffer.length) {
return {
sourceLength: 0,
compressed: null,
};
}
return {
sourceLength: buffer.length,
compressed: compress(buffer, {
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
mode: modes.indexOf(argv.mode) as 0 | 1 | 2,
quality: argv.quality as Quality,
lgwin: argv.lgwin,
}),
};
})
.then(async ({ sourceLength, compressed }) => {
if (printToStdOut) {
process.stdout.write(compressed);
process.stdout.write(compressed ?? "");
return;
}
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (compressed == null) {
if (sourceLength && compressed == null) {
throw new TypeError("Empty response returned from brotli");
}
return writeFile(argv.br ? file + ".br" : file, compressed);
return writeFile(argv.br ? file + ".br" : file, compressed ?? "");
});

@@ -196,0 +206,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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