# @ergosphere-it/client 中文文档

规范地址：https://npmcn.com/package/%40ergosphere-it/client/

版本：0\.0\.16
npm 元数据更新时间：2026-10-29T01:00:53.855Z
中文译文更新时间：2026-11-13T20:51:54.268Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40ergosphere-it/client
原文对照：https://npmcn.com/package/%40ergosphere-it/client/?lang=original
项目主页：https://github.com/moeru-ai/ergosphere-it
源码仓库：https://github.com/moeru-ai/ergosphere-it

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

- 包体积（解压后）：147 kB，10 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=24
- 运行依赖：5 个
- 首次发布：2026-10-24T16:36:14.808Z
- 最新版本发布：2026-10-29T01:00:53.359Z
- 近 30 天下载量：7612（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：17（近 12 个月 17 个）

## 中文简介

为 TypeScript 主机更新 ergosphere- it的状态机器

## 安装

```sh
npm install @ergosphere-it/client
```

也可以使用：`pnpm add @ergosphere-it/client`、`yarn add @ergosphere-it/client`、`bun add @ergosphere-it/client`

## README

# `@ergosphere-it/client`

一个安装的更新状态机器,用于TypeScript主机. 主机注入网络,文件系统,和时钟,所以客户端运行在任意运行的时间.

## 它会做什么

-   检查频道文件, 并找到此安装所需的捆绑: 更新, 签名, 用于此本地版本, 在推出和组中 .
-   阶段一捆:它重新使用磁盘上的文件,一次下载其余的几个,恢复被损坏的下载,检查每个散列,并构建捆绑目录.
-   选择捆绑到靴子,计算靴子的尝试,并屏蔽一个从未报告健康的捆绑.
-   卷回,记录原因, 并保持记录 直到应用程序驳回它.
-   检查新安装器的频道文件,并以应用程序使用的格式返回该平台的安装器文件.

它从不运行代码。 主机加载客户端选择的捆绑.

## 使用量

```ts
import { UpdateClient } from '@ergosphere-it/client'
import { createNodeFileSystem } from '@ergosphere-it/client/node'

const client = new UpdateClient({
  channel: 'stable',
  dataDir,
  feedUrl: 'https://updates.example.com',
  fs: createNodeFileSystem(),
  host: 'electron',
  installerBundle,
  nativeVersion: 2,
  platform: 'darwin-arm64',
  product: 'my-app',
  trustedKeys,
})

const selection = await client.boot()
// Load selection.dir, then, when the app works:
await client.markHealthy(selection)

const checked = await client.check()
if (checked.status === 'available')
  await client.stage(checked, { onProgress: ({ downloadedBytes, totalBytes }) => {} })
```

[API 设计](https://npmcn.com/package/docs/api.md#ergosphere-itclient) 列出每一种方法和结果.

## 何时使用

-   您写入新运行时间的主机, 例如另一个桌面外壳的启动器 .
-   你测试没有Electron的更新行为,用一个假网络和一个临时目录.

## 不使用时

-   你给Electron软件添加了更新 使用 [`@ergosphere-it/electron`](https://npmcn.com/package/%40ergosphere-it/electron),它运行着这个客户端的发射器.

## 常见问题

### @ergosphere-it/client 是什么？

为 TypeScript 主机更新 ergosphere- it的状态机器

### 如何安装 @ergosphere-it/client？

在项目目录运行 npm install @ergosphere-it/client，或使用 pnpm add / yarn add / bun add。

### @ergosphere-it/client 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @ergosphere-it/client 支持 ESM 还是 CommonJS？

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

### @ergosphere-it/client 需要什么版本的 Node\.js？

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

### @ergosphere-it/client 可以商用吗？

@ergosphere-it/client 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @ergosphere-it/client 的下载量有多少？

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

### @ergosphere-it/client 还在维护吗？

最新版本 0\.0\.16 发布于 2026/10/29（15 天前）；至今共发布 17 个版本，其中过去 12 个月发布了 17 个；首次发布于 2026/10/25。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

