3.0.10 • Published 3 months ago

@web-alchemy/web-compressor v3.0.10

Weekly downloads
-
License
-
Repository
github
Last release
3 months ago

Web Compressor

Utility for creating gzip and brotli pre-compressed files for a static web serving.

Using as a CLI

Base example (run inside folder with static assets):

npx @web-alchemy/web-compressor

Example with all parameters:

npx @web-alchemy/web-compressor \
  --input=<input-folder> \
  --output=<output-folder> \
  --formats=gzip,brotli \
  --ext-white-list=.html,.css,.js,.json,.svg,.txt,.xml \
  --concurrency=4 \
  --file-size=4096

Using as a module

npm install @web-alchemy/web-compressor

const { compress, formats } = require('@web-alchemy/web-compressor');

compress({
  input: '<input-folder>',
  output: '<output-folder>',
  formats: [formats.GZIP, formats.BROTLI]
  extWhiteList: ['.html', '.css', '.js', '.json', '.svg', '.txt', '.xml'],
  concurrency: 4,
  fileSize: 4096
}).then(() => {
  // operation end
}).catch(() => {
  // operation error
});

Params Description

CLI ParamModule ParamDescriptiondefault value
--from (alias --input)from (alias input)Input folderprocess.cwd()
--to (alias --output)to (alias output)Output folderfrom param value
--formatsformatsFormats of output files['gzip', 'brotli']
--ext-white-listextWhiteListA list of extensions that will be used to filter the necessary files['.html', '.css', '.js', '.json', '.svg', '.txt', '.xml']
--concurrencyconcurrencynumber of parallel handlersos.cpus().length
--file-sizefileSizeFile size treshold in bytes. Files smaller than this size will be ignored0

Enabling precompressed files serving in web servers

3.0.10

3 months ago

3.0.9

3 months ago

3.0.8

1 year ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.3.7

3 years ago

2.3.6

4 years ago

2.3.5

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.4-beta.0

4 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.0

5 years ago