# @fluid-tools/fetch-tool 中文文档

规范地址：https://npmcn.com/package/%40fluid-tools/fetch-tool/

版本：3\.12\.0
npm 元数据更新时间：2026-11-10T22:50:45.961Z
中文译文更新时间：2026-11-15T02:34:22.668Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40fluid-tools/fetch-tool
原文对照：https://npmcn.com/package/%40fluid-tools/fetch-tool/?lang=original
项目主页：https://fluidframework.com/
源码仓库：https://github.com/microsoft/FluidFramework

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

- 包体积（解压后）：515 kB，72 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：15 个
- 首次发布：2021-12-08T23:07:16.166Z
- 最新版本发布：2026-11-10T22:50:45.789Z
- 近 30 天下载量：3621（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：513（近 12 个月 48 个）

## 中文简介

从中继服务获取流体数据的控制台工具

## 安装

```sh
npm install @fluid-tools/fetch-tool
```

也可以使用：`pnpm add @fluid-tools/fetch-tool`、`yarn add @fluid-tools/fetch-tool`、`bun add @fluid-tools/fetch-tool`

## README

# @ fluid-tools/ fach-tool (英语)

使用 ODSP 或路由驱动器连接,将信件或快照信息丢入服务器 . 要连接到 ODSP, 必须将客户端ID 设定为环境变量 `fetch__tool__clientId`。如果您可以访问密钥断层,可以通过运行实现 [此工具](https://npmcn.com/tools/getkeys)。 。 。 . 当心在微软租户的文档上使用取取工具时,需要遵循取取工具在内部Fluid wiki"调试工具"页面上的取取工具使用指令.

**注: 此软件包是用于 [微软/流体框架](https://github.com/microsoft/FluidFramework) 仓库.** **不要将此套件作为公共依赖.** **我们不保证这一一揽子计划或其API的稳定.**

## 安装

运行此命令以安装软件包 :

```bash
npm i @fluid-tools/fetch-tool -D
```

## 使用量

```
Usage: fluid-fetch [options] "URL"
URL: <ODSP joinSession URL>|<Routerlicious URL>
Options:
  --dump:rawmessage               : dump all messages
  --dump:rawmessage:overwrite     : dump all messages and overwrite existing        messages.json
  --dump:snapshotVersion          : dump a list of snapshot version
  --dump:snapshotTree             : dump the snapshot trees
  --dump:snapshotBlob             : dump the contents of snapshot blobs
  --stat:message                  : show a table of message type counts and size
  --stat:snapshot                 : show a table of snapshot path and blob size
  --stat:dataType                 : show a table of data type
  --stat:channel                  : show a table of channel
  --filter:messageType <type>     : filter message by <type>
  --jwt <token>                   : token to be used for routerlicious URLs
  --numSnapshotVersions <number>  : Number of versions to load (default:10)
  --snapshotVersionIndex <number> : Index of the version to dump
  --saveDir <outdir>              : Save data of the snapshots and messages
  --loginHint <user>              : Username to prefill for interactive authentication against ODSP
```

### 提示

-   如果还没有完成运行 `npm run build`
-   示例命令 - 运行 `node lib/fluidFetch.js --saveDir example 'get-versions-fetch-url'` 输入 `fetch-tool` 目录
    -   看这个 `getVersions` 调用相关的驱动程序以构建右侧的 url
    -   如果您可以访问文档,也可以查看标准浏览器的devtools,也可以在那里查看url.
    -   此命令创建 `example` 目录( 如果不存在) `fetch-tool` 文件夹.
    -   如果多次运行而不清除 `example` 目录,快照将覆盖任何旧文件夹或文件.
-   看着 `example` 目录 :
    -   转到 `1-XYZ/decoded/tree.json` 看那棵快照树.
    -   每个 `'#-XYZ'` 字符串在 `tree.json` 与解码文件夹中的文件相关。 这些文件基本上是杂碎的.
    -   `0-XYZ/decoded/tree.json` 是一个更古老的快照树.
    -   这个 `messages.json` 是存储的操作/消息列表.
-   如上所述,401个认证错误请检查: [钥匙](https://npmcn.com/tools/getkeys) 已经运行.

## 示例输出

### 信件显示

**\--stat:消息**

```
105 total messages (103 delta storage, 2 initial ws messages, 0 dup)
Message Type (All)                                                       | Count      Bytes
----------------------------------------------------------------------------------------------------
join                                                                     |    19       7588
propose                                                                  |     1        269
noop                                                                     |    15       2806
attach                                                                   |     1        278
op                                                                       |    53      23854
leave                                                                    |    16       3810
----------------------------------------------------------------------------------------------------
Total                                                                    |   105      38605
```

**\--stat:数据类型**

```
107 total messages (105 delta storage, 2 initial ws messages, 0 dup)
Data Type (Operations only)                                              | Count      Bytes
----------------------------------------------------------------------------------------------------
map                                                                      |    28      13172
mergeTree                                                                |    20       7450
----------------------------------------------------------------------------------------------------
Total                                                                    |    48      20622
```

**\--stat:频道**

```
109 total messages (107 delta storage, 2 initial ws messages, 0 dup)
Channel name (Operations only)                                           | Count      Bytes
----------------------------------------------------------------------------------------------------
[defaultDataStore]/root (map)                                            |     3       1232
[defaultDataStore]/0fb26504-369f-4234-ad97-0a303d3ec81f (map)            |     0          0
[defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8 (mergeTree)      |    20       7450
[defaultDataStore]/91ac6df2-dda6-409a-b5e3-be84ce9ab138 (map)            |    25      11940
[defaultDataStore]/92ebb388-68a0-4fc2-859e-5c01f12e992d (map)            |     0          0
----------------------------------------------------------------------------------------------------
Total                                                                    |    48      20622
```

### 抓图

**\--stat: snapshot (英语)**

```
Blob Path                                                                  | Bytes
----------------------------------------------------------------------------------------------------
!CONTAINER!/.attributes                                                    | 156
!CONTAINER!/.blobs                                                         | 4
!CONTAINER!/.gitmodules                                                    | 140
!CONTAINER!/deltas                                                         | 872
!CONTAINER!/quorumMembers                                                  | 220
!CONTAINER!/quorumProposals                                                | 4
!CONTAINER!/quorumValues                                                   | 184
[defaultDataStore]/.component                                              | 32
[defaultDataStore]/0fb26504-369f-4234-ad97-0a303d3ec81f/.attributes        | 64
[defaultDataStore]/0fb26504-369f-4234-ad97-0a303d3ec81f/header             | 4
[defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/.attributes        | 72
[defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/content/header     | 448
[defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/content/catchupOps | 4
[defaultDataStore]/74577601-3af5-49a1-9ca5-db5d9ee128a8/header             | 180
[defaultDataStore]/91ac6df2-dda6-409a-b5e3-be84ce9ab138/.attributes        | 64
[defaultDataStore]/91ac6df2-dda6-409a-b5e3-be84ce9ab138/header             | 168
[defaultDataStore]/92ebb388-68a0-4fc2-859e-5c01f12e992d/.attributes        | 64
[defaultDataStore]/92ebb388-68a0-4fc2-859e-5c01f12e992d/header             | 4
[defaultDataStore]/root/.attributes                                        | 64
[defaultDataStore]/root/header                                             | 300
----------------------------------------------------------------------------------------------------
Total snapshot size                                                        | 3048
```

## 调试

如果您想要调试取取工具,可以创建单位测试. 记住要添加 tsconfig.json 并在 devdependents 中列出摩查.

在单位测试中,可以使用 `setArguments()` 从流体FetchArgs到通过您想要测试的参数。 然后调用您想要运行的方法, 您可以在 vscode 中设置断点 .

**示例**

```js
describe("fetch tool", () => {
    it("can fetch messages", async () => {
        fluidFetchArgs.setArguments(your_args);
        const documentService = await fluidFetchInit(your_paramURL);
        await fluidFetchMessages(documentService, your_saveDir);
    });
});
```

## 贡献准则

你们可以 [贡献](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) 通过这些方式实现流体框架:

-   回答问题 [GitHub 讨论](https://github.com/microsoft/FluidFramework/discussions)。 。 。 .
-   [提交错误报告](https://github.com/microsoft/FluidFramework/issues) 并且帮助验证修正.
-   审查 [源代码更改](https://github.com/microsoft/FluidFramework/pulls)。 。 。 .
-   [贡献错误修正](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md)。 。 。 .

详细指示改为: [repo 文档](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md)。 。 。 .

本项目遵循 [Microsoft 开源行为守则](https://opensource.microsoft.com/codeofconduct/)。 。 。 . 更多信息,改为: [《行为守则》经常被问到的问题](https://opensource.microsoft.com/codeofconduct/faq/)。 。 。 . 问题或评论,联系 [打开码@ microsoft.com](mailto:opencode@microsoft.com)。 。 。 .

这个项目可能包含微软项目的商标或标志,产品,或服务. 这些商标或标志的使用必须遵循微软 [商标和品牌准则](https://www.microsoft.com/trademarks)。 。 。 . 在这个项目的修改后版本中使用微软商标或标志不得造成混淆或暗示微软赞助.

## 帮助

读取 [流体框架文件](https://fluidframework.com/docs/) 用于了解流体框架概念和API.

要求提供文件未载列的资料, [创建问题](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md)。 。 。 .

## 商标

这个项目可能包含微软项目的商标或标志,产品,或服务.

这些商标或标志的使用必须遵循微软的 [商标和品牌准则](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general)。 。 。 .

在这个项目的修改后版本中使用微软商标或标志不得造成混淆或暗示微软赞助.

## 常见问题

### @fluid-tools/fetch-tool 是什么？

从中继服务获取流体数据的控制台工具

### 如何安装 @fluid-tools/fetch-tool？

在项目目录运行 npm install @fluid-tools/fetch-tool，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 fluid-fetch，可以用 npx fluid-fetch 直接运行。

### @fluid-tools/fetch-tool 支持 TypeScript 吗？

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

### @fluid-tools/fetch-tool 支持 ESM 还是 CommonJS？

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

### @fluid-tools/fetch-tool 可以商用吗？

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

### @fluid-tools/fetch-tool 的下载量有多少？

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

### @fluid-tools/fetch-tool 还在维护吗？

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

