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

compression-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compression-webpack-plugin - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

26

index.js

@@ -14,2 +14,3 @@ /*

this.algorithm = options.algorithm || "gzip";
this.compressionOptions = {};
if(typeof this.algorithm === "string") {

@@ -22,12 +23,13 @@ if (this.algorithm === "zopfli") {

}
this.algorithm = function (content, fn) {
zopfli.gzip(content, {
verbose: options.hasOwnProperty('verbose') ? options.verbose : false,
verbose_more: options.hasOwnProperty('verbose_more') ? options.verbose_more : false,
numiterations: options.numiterations ? options.numiterations : 15,
blocksplitting: options.hasOwnProperty('blocksplitting') ? options.blocksplitting : true,
blocksplittinglast: options.hasOwnProperty('blocksplittinglast') ? options.blocksplittinglast : false,
blocksplittingmax: options.blocksplittingmax ? options.blocksplittingmax : 15
}, fn);
this.compressionOptions = {
verbose: options.hasOwnProperty('verbose') ? options.verbose : false,
verbose_more: options.hasOwnProperty('verbose_more') ? options.verbose_more : false,
numiterations: options.numiterations ? options.numiterations : 15,
blocksplitting: options.hasOwnProperty('blocksplitting') ? options.blocksplitting : true,
blocksplittinglast: options.hasOwnProperty('blocksplittinglast') ? options.blocksplittinglast : false,
blocksplittingmax: options.blocksplittingmax ? options.blocksplittingmax : 15
};
this.algorithm = function (content, options, fn) {
zopfli.gzip(content, options, fn);
};
} else {

@@ -37,3 +39,3 @@ var zlib = require("zlib");

if(!this.algorithm) throw new Error("Algorithm not found in zlib");
this.algorithm = this.algorithm.bind(zlib, {
this.compressionOptions = {
level: options.level || 9,

@@ -46,3 +48,3 @@ flush: options.flush,

dictionary: options.dictionary
});
};
}

@@ -72,3 +74,3 @@ }

if(originalSize < this.threshold) return callback();
this.algorithm(content, function(err, result) {
this.algorithm(content, this.compressionOptions, function(err, result) {
if(err) return callback(err);

@@ -75,0 +77,0 @@ if(result.length / originalSize > this.minRatio) return callback();

{
"name": "compression-webpack-plugin",
"version": "0.3.0",
"version": "0.3.1",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "Prepare compressed versions of assets to serve them with Content-Encoding",

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