@ergosphere-it/client
一个安装的更新状态机器,用于TypeScript主机. 主机注入网络,文件系统,和时钟,所以客户端运行在任意运行的时间.
它会做什么
- 检查频道文件, 并找到此安装所需的捆绑: 更新, 签名, 用于此本地版本, 在推出和组中 .
- 阶段一捆:它重新使用磁盘上的文件,一次下载其余的几个,恢复被损坏的下载,检查每个散列,并构建捆绑目录.
- 选择捆绑到靴子,计算靴子的尝试,并屏蔽一个从未报告健康的捆绑.
- 卷回,记录原因, 并保持记录 直到应用程序驳回它.
- 检查新安装器的频道文件,并以应用程序使用的格式返回该平台的安装器文件.
它从不运行代码。 主机加载客户端选择的捆绑.
使用量
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 设计 列出每一种方法和结果.
何时使用
- 您写入新运行时间的主机, 例如另一个桌面外壳的启动器 .
- 你测试没有Electron的更新行为,用一个假网络和一个临时目录.
不使用时
- 你给Electron软件添加了更新 使用
@ergosphere-it/electron,它运行着这个客户端的发射器.