# @fluid-internal/client-utils

> Not intended for use outside the Fluid Framework.

Latest version **3.1.0** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fluid-internal/client-utils
pnpm add @fluid-internal/client-utils
yarn add @fluid-internal/client-utils
bun add @fluid-internal/client-utils
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2026-09-16 |
| First published | 2023-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 7 |
| Unpacked size | 413.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4946 |
| Author | Microsoft and contributors |
| Maintainers | ms-fluid-bot, microsoft-oss-releases, microsoft1es |

## Links

- npm: https://www.npmjs.com/package/@fluid-internal/client-utils
- Repository: https://github.com/microsoft/FluidFramework
- Homepage: https://fluidframework.com
- Issues: https://github.com/microsoft/FluidFramework/issues
- npm.io page: https://npm.io/package/@fluid-internal/client-utils

## Dependencies (7)

- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [sha.js](https://npm.io/package/sha.js.md) ^2.4.12
- [base64-js](https://npm.io/package/base64-js.md) ^1.5.1
- [events_pkg](https://npm.io/package/events_pkg.md) npm:events@^3.1.0
- [@types/events_pkg](https://npm.io/package/@types/events_pkg.md) npm:@types/events@^3.0.0
- [@fluidframework/core-utils](https://npm.io/package/@fluidframework/core-utils.md) ~3.1.0
- [@fluidframework/core-interfaces](https://npm.io/package/@fluidframework/core-interfaces.md) ~3.1.0

## Recent versions

- 3.1.0 (latest) — 2026-09-16
- 2.118.1 (rc) — 2026-09-08
- 2.116.0-416006 (dev) — 2026-08-11
- 2.0.0-internal.8.0.8 (canary) — 2024-03-20
- 2.0.0-dev-rc.1.0.0.225277 (next) — 2023-12-20
- 3.0.2 — 2026-09-11
- 3.0.1 — 2026-09-09
- 3.0.0 — 2026-09-04
- 2.118.0 — 2026-09-04
- 2.117.0 — 2026-08-28
- 2.116.1 — 2026-08-26
- 2.116.0 — 2026-08-18
- 2.115.0 — 2026-08-10
- 2.114.0 — 2026-08-03
- 2.113.1 — 2026-07-29
- … 257 more at https://npm.io/package/@fluid-internal/client-utils/versions

## README

# @fluid-internal/client-utils

This package is intended for sharing and promoting utility functions across packages in the Fluid Framework repo,
primarily within the client release group.

<!-- markdown-magic:begin {"transform":"library-readme-header","headingLevel":2} -->
<!-- prettier-ignore-start -->
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->

**IMPORTANT: Fluid Framework uses this package as an implementation detail.**
**Do not use it as a public dependency.**
**We do not guarantee the stability of this package or its APIs.**

<!-- prettier-ignore-end -->
<!-- markdown-magic:end -->

## Adding code to this package

As a utility package, this package does not have a strong identity. This means that it's easy to become a "dumping
ground" for code that we think we should share but doesn't have an obvious home. We try to avoid dumping things into
utility packages, and this one is no exception.

New code should only be added to this package in rare circumstances. In most cases, the code would be better placed in a
package with a clear identity (e.g. an "events" package for shared event infrastructure) or not shared at all.

## Requirements

This package has important requirements for the code within it.

1. Code within this package should require some external dependencies. If it does not, then the **core-utils** package
   is a better location.
1. **All exports must be designated `@internal`.** This code is intended for use within the Fluid Framework only.
   **Excepting the small set of typed event emitter APIs** that are in use by legacy test support.
1. This package should **only contain 'implementation' code, not type definitions.** This is the most flexible rule, and
   there are some exceptions. If the type is _only_ necessary when using this package, then it is probably OK. However,
   usually such types would be better placed in core-interfaces or in a package that corresponds to the purpose.

If you want to add code that does not meet these requirements, these other packages may be a better choice:

-   **Types and interfaces** that are intended to be broadly shared across the client release group should be put in the
    **core-interfaces** package.
-   **Zero-dependency shared code** should be put in the **core-utils** package.

## Isomorphic Code

One of the primary reasons for this package's existence is to provide isomorphic implementations of
Buffer and related utilities that work in both browser and Node.js environments.

Our general strategy for this is as follows:

-   We use the export map in package.json to provide different entrypoints for browser (indexBrowser.js)
    vs. Node.js (indexNode.js).

-   Because the browser ecosystem is more complex (bunders, etc.), we improve our odds of success by making
    the browser the default. Only Node.js relies on remapping via the export map.

-   We further simplify things by only using the export map to resolve the initial entrypoint. We do not
    rely on export maps to remap imports within the module. (Basically, the browser / node.js specific
    implementations fork at the entrypoint and from that point on explicitly import browser or node
    specific files.)

One thing it is important to be aware of is that our CJS support relies on copying a stub package.json
file to dist/package.json to set the module type to commonjs. When resolving internal imports for CJS
packages, module resolution will walk up from the \*.js file and discover this stub package.json. Because
the stub package.json lacks an export map, internal imports will not be remapped.

## Export Reports and Linting

With the current case of legacy APIs that are present here and the isometric browser and Node.js support,
generation and checking of APIs is unique within client group. `lib/client-utils.(browser|node).*.d.ts` files
are generated but not used in production (excluded from npm package).

For local (development) builds browser reports are generated first and Node.js reports are then verified to
be the same as browser. (Both report sets use the same target files.)

Package scripts `check:exports:esm:indexBrowser:legacy` and `check:exports:esm:indexNode:legacy` are not
verifying actual exports, but the consistency of tags within the legacy API set.

<!-- markdown-magic:begin {"transform":"readme-footer","headingLevel":2} -->
<!-- prettier-ignore-start -->
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->

## Contribution Guidelines

You can [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid Framework in these ways:

- Answer questions in [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
- [Submit bug reports](https://github.com/microsoft/FluidFramework/issues) and help verify fixes.
- Review [source code changes](https://github.com/microsoft/FluidFramework/pulls).
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).

For detailed instructions, read the [repo documentation](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).

This project follows the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information, read the [Code of Conduct frequently asked questions](https://opensource.microsoft.com/codeofconduct/faq/).
For questions or comments, contact <opencode@microsoft.com>.

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](https://www.microsoft.com/trademarks).
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](https://fluidframework.com/docs/) for information about Fluid Framework concepts and APIs.

To request information that the documentation does not contain, [create an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).

## 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](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).

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

<!-- prettier-ignore-end -->
<!-- markdown-magic:end -->

---
_Source: https://npm.io/package/@fluid-internal/client-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
