@fluid-tools/fetch-tool

中文文档
3.12.0发布于 2026/11/11MITES Module近 30 天下载 3621

Console tool to fetch Fluid data from relay service

原始使用文档
文档目录10 节
  1. Installation
  2. Usage
  3. Tips
  4. Example Output
  5. Messages Stats
  6. Snapshot Stats
  7. Debugging
  8. Contribution Guidelines
  9. Help
  10. Trademark

@fluid-tools/fetch-tool

Connection using ODSP or routerlicious driver to dump the messages or snapshot information on the server. In order to connect to ODSP, the clientID must be set as the environment variable fetch__tool__clientId. If you have access to the keyvault this can be done by running this tool. Beware that to use fetch-tool on documents in the Microsoft tenant, you will need to follow the fetch tool usage instructions on the "Debugging Tools" page of the internal Fluid wiki.

NOTE: This package is a library for use in the microsoft/FluidFramework repository. Do not use this package as a public dependency. We do not guarantee the stability of this package or its APIs.

Installation

Run this command to install the package:

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

Usage

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

Tips

  • If not done already run npm run build
  • Example command - run node lib/fluidFetch.js --saveDir example 'get-versions-fetch-url' in the fetch-tool directory
    • Look at the getVersions call in the relevant driver to build the right url
    • If you have access to the document, you can also look at the standard browser devtools and look for the url there as well.
    • This command creates an example directory (if it doesn't exist) in the fetch-tool folder.
    • If run multiple times without clearing the example directory, the snapshot will overwrite any old folders or files.
  • Looking at the example directory:
    • Go to 1-XYZ/decoded/tree.json to see the snapshot tree.
    • Each '#-XYZ' string in the tree.json correlates to a file in the decoded folder. These files are essentially blobs.
    • 0-XYZ/decoded/tree.json is an older snapshot tree.
    • The messages.json is a list of ops/messages that are stored.
  • For 401 authentication errors, as stated above, check that getkeys has been run.

Example Output

Messages Stats

--stat:message

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:dataType

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:channel

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

Snapshot Stats

--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

Debugging

If you would like to debug fetch-tool, you can create a unit test. Remember to add tsconfig.json and list mocha in devDependencies.

In the unit test, you can use setArguments() from fluidFetchArgs to pass in arguments you want to test. Then call the methods you want to run and you will be able to set breakpoints in vscode.

Example

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

Contribution Guidelines

You can contribute to Fluid Framework in these ways:

For detailed instructions, read the repo documentation.

This project follows the Microsoft Open Source Code of Conduct. For more information, read the Code of Conduct frequently asked questions. For questions or comments, contact [email protected].

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services. Use of these trademarks or logos must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.

Help

Read the Fluid Framework documentation for information about Fluid Framework concepts and APIs.

To request information that the documentation does not contain, create an issue.

Trademark

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.

Use of these trademarks or logos must follow Microsoft's Trademark & Brand Guidelines.

Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.

版本与发布记录

@fluid-tools/fetch-tool 共发布 513 个版本,首次发布于 2021/12/09;过去 12 个月发布了 48 个版本。

版本发布日期距今
3.12.0latest2026/11/114 天前
3.11.02026/11/0411 天前
3.10.02026/11/0412 天前
3.7.02026/10/2719 天前
3.6.02026/10/2026 天前
3.5.02026/10/131 个月前

其他发布通道:next → 2.0.0-dev-rc.1.0.0.225277,canary → 2.0.0-internal.8.0.8,dev → 2.116.0-416006,rc → 2.118.1。

关于 @fluid-tools/fetch-tool 的常见问题

@fluid-tools/fetch-tool 是什么?

Console tool to fetch Fluid data from relay service

如何安装 @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 和提交记录判断。