gzip-cli is a command-line interface (CLI) and Node.js module designed for compressing files using both Gzip and Brotli algorithms. It provides robust functionality for specifying glob patterns to target files, defining custom output directories, and applying multiple compression extensions (e.g., .gz and .br) in a single command or programmatic call. The package supports ignoring specific file patterns and preserves the original directory structure when outputting compressed files. The current stable version, 1.2.0, was released in December 2020. The project does not adhere to a fixed release cadence. Its key differentiators include comprehensive support for both Gzip and Brotli, dual interfaces for CLI and programmatic usage, and integrated TypeScript types, enhancing developer experience in TypeScript-based projects. It is primarily used in Node.js environments for optimizing static assets during build processes.
npm install gzip-cliVerified import paths — ran on the pinned version, not inferred.
Demonstrates programmatic compression of static assets using Gzip and Brotli, ignoring specific patterns, within an async function.
Upgrade your Node.js environment to version 12 or higher. Alternatively, pin your `gzip-cli` dependency to `1.1.1` if older Node.js versions are required.
Update `gzip-cli` to version `1.1.0` or higher to enable Brotli compression functionality.
Always consult the project's GitHub repository or npm release notes when upgrading to new major or minor versions to understand potential breaking changes or API shifts.
Ensure you are using `gzip-cli@1.0.1` or a later version to incorporate important dependency security patches.
Provide at least one glob pattern, e.g., `gzip 'dist/**/*.js'` or `gzip({ patterns: ['dist/**/*.js'] })`.In CommonJS, use `const { gzip } = require('gzip-cli');` or `const gzipModule = require('gzip-cli'); const gzip = gzipModule.gzip;`.Either use CommonJS `require` syntax (`const { gzip } = require('gzip-cli');`) or ensure your project is configured for ES modules (e.g., `"type": "module"` in `package.json` and correct file extensions like `.mjs`).No dependency data recorded yet.