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

gzipper

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gzipper - npm Package Compare versions

Comparing version 2.9.0 to 2.10.0

6

index.js

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

GZIPPER_INCLUDE,
GZIPPER_THRESHOLD,
GZIPPER_GZIP_LEVEL,

@@ -29,2 +30,6 @@ GZIPPER_GZIP_MEMORY_LEVEL,

.option(
'-t, --threshold [threshold]',
'exclude assets smaller than this byte size. 0 (default)'
)
.option(
'-gl, --gzip-level [level]',

@@ -74,2 +79,3 @@ 'gzip compression level -1 (default), 0 (no compression) - 9 (best compression)'

include: GZIPPER_INCLUDE || program.include,
threshold: +GZIPPER_THRESHOLD || +program.threshold || 0,
gzipLevel: +GZIPPER_GZIP_LEVEL || +program.gzipLevel,

@@ -76,0 +82,0 @@ gzipMemoryLevel: +GZIPPER_GZIP_MEMORY_LEVEL || +program.gzipMemoryLevel,

2

package.json
{
"name": "gzipper",
"version": "2.9.0",
"version": "2.10.0",
"description": "CLI for compressing files.",

@@ -5,0 +5,0 @@ "main": "index.js",

# Gzipper
[![Build Status](https://travis-ci.org/gios/gzipper.svg?branch=master)](https://travis-ci.org/gios/gzipper)
[![npm version](https://badge.fury.io/js/gzipper.svg)](https://badge.fury.io/js/gzipper)
[![codecov](https://codecov.io/gh/gios/gzipper/branch/master/graph/badge.svg)](https://codecov.io/gh/gios/gzipper)
[![Maintainability](https://api.codeclimate.com/v1/badges/e1336defedcb61e5b513/maintainability)](https://codeclimate.com/github/gios/gzipper/maintainability)

@@ -13,8 +13,8 @@ CLI for compressing files using the popular compress algorithms like Brotli and Gzip. Also this module works great with many CLI UI tools (Angular CLI, Vue CLI, create-react-app) and supports few option flags for each algorithm.

- [Gzipper](#Gzipper)
- [Install](#Install)
- [Run script](#Run-script)
- [Options](#Options)
- [Contribution](#Contribution)
- [Requirements](#Requirements)
- [Gzipper](#gzipper)
- [Install](#install)
- [Run script](#run-script)
- [Options](#options)
- [Contribution](#contribution)
- [Requirements](#requirements)

@@ -85,2 +85,3 @@ ## Install

| `-bs, --brotli-size-hint [brotliSizeHint]` | `GZIPPER_BROTLI_SIZE_HINT` | expected input size 0 (default) |
| `-t, --threshold [threshold]` | `GZIPPER_THRESHOLD` | exclude assets smaller than this byte size. 0 (default) |
| `--output-file-format [outputFileFormat]` | `GZIPPER_OUTPUT_FILE_FORMAT` | output file format with default artifacts [filename].[ext].[compressExt], where: filename -> name of your file, ext -> file extension, compressExt -> compress extension (.gz, .br, etc), hash -> uniq uuid/v4 hash. Samples: [filename].[compressExt].[ext], test-[filename]-[hash].[compressExt].[ext], [filename]-[hash]-[filename]-tmp.[ext].[compressExt] |

@@ -87,0 +88,0 @@ | `-h, --help` | | output usage information |

@@ -80,2 +80,7 @@ const fs = require('fs')

if (this.validExtensions.includes(path.extname(filePath))) {
const { size: fileSize } = await lstat(filePath)
if (fileSize < this.options.threshold) {
continue
}
const hrtimeStart = process.hrtime()

@@ -82,0 +87,0 @@ compressedFiles.push(filePath)

@@ -398,2 +398,30 @@ const assert = require('assert')

it('should exclude file sizes smaller than 860 bytes from compression', async () => {
const options = {
threshold: 860,
verbose: true,
}
const INCLUDED_FILES_COUNT = 4
const gzipper = new Gzipper(COMPRESS_PATH, null, options)
const loggerSuccessSpy = sinon.spy(gzipper.logger, 'success')
const loggerInfoSpy = sinon.spy(gzipper.logger, 'info')
await gzipper.compress()
const files = await getFiles(COMPRESS_PATH, ['.gz'])
assert.ok(
loggerSuccessSpy.calledOnceWithExactly(
`${files.length} files have been compressed.`,
true
)
)
assert.strictEqual(loggerInfoSpy.callCount, INCLUDED_FILES_COUNT + 1)
assert.ok(gzipper.createCompression() instanceof zlib.Gzip)
assert.strictEqual(gzipper.compressionInstance.ext, 'gz')
assert.strictEqual(
Object.keys(gzipper.compressionInstance.compressionOptions).length,
0
)
assert.strictEqual(Object.keys(gzipper.options).length, 2)
})
afterEach(async () => {

@@ -400,0 +428,0 @@ await clear(EMPTY_FOLDER_PATH, true)

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