# @frostoven/squoosh-cli 中文文档

规范地址：https://npmcn.com/package/%40frostoven/squoosh-cli/

版本：0\.9\.1
npm 元数据更新时间：2024-04-30T04:32:33.914Z
中文译文更新时间：2026-11-15T15:55:23.330Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40frostoven/squoosh-cli
原文对照：https://npmcn.com/package/%40frostoven/squoosh-cli/?lang=original
项目主页：https://squoosh.frostoven.com/
源码仓库：https://github.com/frostoven/Squoosh-with-CLI

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：15.4 kB，5 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=16\.0\.0
- 运行依赖：5 个
- 首次发布：2023-05-20T08:07:40.950Z
- 最新版本发布：2024-04-30T04:32:33.730Z
- 近 30 天下载量：2594（2026-10-16 至 2026-11-14，npm 官方下载统计）
- 已发布版本数：6（近 12 个月 0 个）

## 中文简介

斯库什的CLI

## 安装

```sh
npm install @frostoven/squoosh-cli
```

也可以使用：`pnpm add @frostoven/squoosh-cli`、`yarn add @frostoven/squoosh-cli`、`bun add @frostoven/squoosh-cli`

## README

# 斯克沃什 CLI

Squoosh CLI是一种实验方法 运行所有你认识的解码器 [斯库什语Name](https://squoosh.frostoven.com/) 使用 web app在命令行上的网络应用程序 网易大会. Squoosh CLI 使用工人池来平行加工 图像。 这样您就可以同时对许多图像应用同样的代码.

Squoosh CLI 目前不是镇上最快的图像压缩工具 并不打算成为。 但是,它足够快 压缩许多图像 足够快的一次.

请注意,这是叉子 [原始图书馆](https://www.npmjs.com/package/@squoosh/cli),已经 从退休以来 这个叉子继续工作,并有一些错误修正.

## 安装

Squoosh CLI 可以从命令行直接使用而不使用 `npx`数字 :

```
$ npx @frostoven/squoosh-cli <options...>
```

当然,您也可以安装 Squoosh CLI :

```
$ npm i -g @frostoven/squoosh-cli
$ squoosh-cli <options...>
```

## 使用量

```
Usage: squoosh-cli [options] <files...>

Options:
  -d, --output-dir <dir>                                 Output directory (default: ".")
  -s, --suffix <suffix>                                  Append suffix to output files (default: "")
  -c, --max-concurrent-files <count>                     Amount of files to process at once (defaults to your CPU core count)
  --max-optimizer-rounds <rounds>                        Maximum number of compressions to use for auto optimizations (default: "6")
  --optimizer-butteraugli-target <butteraugli distance>  Target Butteraugli distance for auto optimizer (default: "1.4")
  --resize [config]                                      Resize the image before compressing
  --quant [config]                                       Reduce the number of colors used (aka. paletting)
  --rotate [config]                                      Rotate image
  --mozjpeg [config]                                     Use MozJPEG to generate a .jpg file with the given configuration
  --webp [config]                                        Use WebP to generate a .webp file with the given configuration
  --avif [config]                                        Use AVIF to generate a .avif file with the given configuration
  --jxl [config]                                         Use JPEG-XL to generate a .jxl file with the given configuration
  --wp2 [config]                                         Use WebP2 to generate a .wp2 file with the given configuration
  --oxipng [config]                                      Use OxiPNG to generate a .png file with the given configuration
  -V, --version                                          Output associated version numbers
  -h, --help                                             Display help for command
```

每个的默认值 `config` 选项可以在 [`codecs.ts`](https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.ts) 文件编号 `defaultEncoderOptions`。每个未指定值都将使用此处指定的默认值. _这里需要更好的文件._

## 自动优化器

Squoosh CLI有一个 _实验_ 尽可能压缩图像的自动优化器,试图击中特定 [黄油](https://github.com/google/butteraugli) 目标值。 巴特劳格利的目标值越高,可以引进的文物就越多.

通过使用“自动”作为配置对象,您可以使用自动优化器.

```
$ npx @frostoven/squoosh-cli --wp2 auto test.png
```

## 常见问题

### @frostoven/squoosh-cli 是什么？

斯库什的CLI

### 如何安装 @frostoven/squoosh-cli？

在项目目录运行 npm install @frostoven/squoosh-cli，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 squoosh-cli、squoosh-cli-debug，可以用 npx squoosh-cli 直接运行。

### @frostoven/squoosh-cli 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/frostoven\_\_squoosh-cli 是否存在。

### @frostoven/squoosh-cli 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @frostoven/squoosh-cli 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=16\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @frostoven/squoosh-cli 可以商用吗？

@frostoven/squoosh-cli 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @frostoven/squoosh-cli 的下载量有多少？

根据 npm 官方下载统计，@frostoven/squoosh-cli 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,594 次，日均约 86 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @frostoven/squoosh-cli 还在维护吗？

最新版本 0\.9\.1 发布于 2024/04/30（2 年前）；至今共发布 6 个版本，其中过去 12 个月发布了 0 个；首次发布于 2023/05/20。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

