# serializeSegmentedTrie

> **serializeSegmentedTrie**<`V`>(`trie`, `codec`, `options?`): `Uint8Array`

Defined in: [packages/trie/src/serialization/binary.ts:106](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/trie/src/serialization/binary.ts#L106)

Serialize a segmented trie as a shared UTF-8 string table, a depth-first parent-pointer node table, and a parallel terminal-value run.

## Type Parameters

### V

`V`

## Parameters

### trie

[`SegmentedTrie`](/reference/knotkit/trie/interfaces/segmentedtrie/)<`V`>

### codec

[`ElementCodec`](/reference/knotkit/wire/interfaces/elementcodec/)<`V`>

### options?

[`SerializeSegmentedTrieOptions`](/reference/knotkit/trie/wire/interfaces/serializesegmentedtrieoptions/)

## Returns

`Uint8Array`

## Throws

With `MISSING_ELEMENT_CODEC` when `codec` is absent, and with `INVALID_SEGMENT`, `INVALID_CODEC_RESULT`, `NON_INJECTIVE_CODEC`, or `SERIALIZATION_LIMIT_EXCEEDED` when the trie cannot be represented safely.
