# precompress

> CLI to compress files to gzip, brotli, zst

Latest version **13.0.8** (published 2026-09-14) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install precompress
pnpm add precompress
yarn add precompress
bun add precompress
```

Provides the command `precompress`.

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 13.0.8 |
| Published | 2026-09-14 |
| First published | 2018-08-05 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 0 |
| Unpacked size | 43 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | silverwind <me@silverwind.io> |
| Maintainers | silverwind |

## Links

- npm: https://www.npmjs.com/package/precompress
- Repository: silverwind/precompress
- npm.io page: https://npm.io/package/precompress

## Recent versions

- 13.0.8 (latest) — 2026-09-14
- 13.0.7 — 2026-08-11
- 13.0.6 — 2026-04-21
- 13.0.5 — 2026-02-14
- 13.0.3 — 2025-11-13
- 13.0.2 — 2025-09-29
- 13.0.1 — 2025-09-14
- 13.0.0 — 2025-09-14
- 12.0.7 — 2025-02-17
- 12.0.6 — 2024-12-04
- 12.0.5 — 2024-04-13
- 12.0.4 — 2024-03-19
- 12.0.3 — 2024-03-19
- 12.0.2 — 2023-10-23
- 12.0.1 — 2023-09-24
- … 68 more at https://npm.io/package/precompress/versions

## README

# precompress
[![](https://img.shields.io/npm/v/precompress.svg?style=flat)](https://www.npmjs.org/package/precompress) [![](https://img.shields.io/npm/dm/precompress.svg)](https://www.npmjs.org/package/precompress) [![](https://packagephobia.com/badge?p=precompress)](https://packagephobia.com/result?p=precompress)

CLI to compress files to gzip, brotli and zstd. Files are efficiently compressed in parallel. Existing output files will always be overridden.

## Usage
```bash
# compress all files in the "build" directory using node
npx precompress ./build

# same with bun
bunx precompress ./build
```

## Options
```
usage: precompress [options] <files,dirs,...>

  Options:
    -t, --types <type,...>    Types of files to generate. Default: gz,br,zst
    -i, --include <glob,...>  Only include given globs. Default: unset
    -e, --exclude <glob,...>  Exclude given globs. Default: **.gz,**.br
    -m, --mtime               Skip creating existing files when source file is newer
    -f, --follow              Follow symbolic links
    -d, --delete              Delete source file after compression
    -o, --outdir              Output directory, will preserve relative path structure
    -b, --basedir             Base directory to derive output path, use with --outdir
    -E, --extensionless       Do not output a extension, use with single --type and --outdir
    -s, --silent              Do not print anything
    -S, --sensitive           Treat include and exclude patterns case-sensitively
    -c, --concurrency <num>   Number of concurrent operations. Default: auto
    -V, --verbose             Print individual file compression times
    -h, --help                Show this text
    -v, --version             Show the version

  Examples:
    $ precompress ./build
```

© [silverwind](https://github.com/silverwind), distributed under BSD licence

---
_Source: https://npm.io/package/precompress · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
