/gzip-cli

gzip files

Primary LanguageJavaScriptMIT LicenseMIT

npm npm Travis Coveralls github

gzip-cli

Provide possibility to gzip files from npm script section. Also you can use it in your code as imported module.

Install

npm i gzip-cli

Command Line

Usage: gzip [glob patterns]

Options:
-o, --output               output directory
-e, --extension            output file extension (default=gz)

CLI example

gzip dist/**/*.js

Will gzip all *.js files in folder dist and output them to the same folder, e.g.

dist/public/main.js -> dist/public/main.js.gz

gzip source/**/*.js --output=dist

Will gzip all *.js files in folder source and output them to the dist folder with saving file paths relative to glob base, e.g.

source/utils/fileUtils.js -> dist/utils/fileUtils.js.gz

gzip(patterns, [outputDir])

  • patterns {Array<String>} Patterns to be matched
  • outputDir {String} Output dir

Code example

const gzib = require('gzib');
gzip(['source/**/*.js'], 'dist');

Will gzip all *.js files in folder source and its sub-folders and output them to the dist folder with saving file paths relative to glob base, e.g.

source/public/main.js -> dist/public/main.js.gz