function · Browser and Node

# decodeBody

Reads a body of any known format, choosing by its first byte. Throws `BodyError`.

`@toip-tools/trust-core` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/trust-core/src/compact.ts#L457)

Import:

```ts
import { decodeBody } from "@toip-tools/trust-core";
```

## Declaration

Signature:

```ts
decodeBody(body: Uint8Array, ctx: BodyContext): TrustTaskDocument<unknown>;
```

### Parameters

- **`body` (required)**: `Uint8Array<ArrayBufferLike>`
- **`ctx` (required)**: `BodyContext`

### Returns

`TrustTaskDocument<unknown>`

[Usage guide](https://toip.tools/toolkit/trust-core/#usage) · [Error handling](https://toip.tools/toolkit/trust-core/#errors) · [All exports](https://toip.tools/toolkit/trust-core/api/)

---

This is the Markdown version of https://toip.tools/toolkit/trust-core/api/decodeBody/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
