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.7.0 to 2.8.0

3

index.js

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

GZIPPER_EXCLUDE,
GZIPPER_INCLUDE,
GZIPPER_GZIP_LEVEL,

@@ -26,2 +27,3 @@ GZIPPER_GZIP_MEMORY_LEVEL,

.option('-e, --exclude [exclude]', 'exclude file extensions from compression')
.option('-i, --include [include]', 'include file extensions for compression')
.option(

@@ -71,2 +73,3 @@ '-gl, --gzip-level [level]',

exclude: GZIPPER_EXCLUDE || program.exclude,
include: GZIPPER_INCLUDE || program.include,
gzipLevel: +GZIPPER_GZIP_LEVEL || +program.gzipLevel,

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

2

package.json
{
"name": "gzipper",
"version": "2.7.0",
"version": "2.8.0",
"description": "CLI for compressing files.",

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

@@ -60,2 +60,3 @@ # Gzipper

| `-e, --exclude` | `GZIPPER_EXCLUDE` | exclude file extensions from compression |
| `-i, --include` | `GZIPPER_INCLUDE` | include file extensions for compression |
| `-gl, --gzip-level [level]` | `GZIPPER_GZIP_LEVEL` | gzip compression level -1 (default), 0 (no compression) - 9 (best compression) |

@@ -62,0 +63,0 @@ | `-gm, --gzip-memory-level [memoryLevel]` | `GZIPPER_GZIP_MEMORY_LEVEL` | amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory) |

@@ -302,2 +302,13 @@ const fs = require('fs')

}
const includeExtensions =
this.options.include &&
this.options.include.split(',').map(item => `.${item.trim()}`)
if (includeExtensions) {
return VALID_EXTENSIONS.filter(extension =>
includeExtensions.includes(extension)
)
}
return VALID_EXTENSIONS

@@ -304,0 +315,0 @@ }

@@ -339,2 +339,31 @@ const assert = require('assert')

it('should include only specific file extensions for compression', async () => {
const options = {
include: 'js,css,html',
verbose: true,
}
const INCLUDED_FILES_COUNT = 9
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)
})
it('should exclude file extensions from compression jpeg,jpg', async () => {

@@ -341,0 +370,0 @@ const options = {

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