# ArtifactFormat

Defined in: [packages/wire/src/artifact-format.ts:51](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/wire/src/artifact-format.ts#L51)

One module’s binary artifact: the prelude every decoder runs before it reads its own header, and the framing every encoder applies after it has built its own sections.

## Type Parameters

### Kind

`Kind` *extends* `string`

### Failure

`Failure` *extends* [`KnotkitError`](/reference/knotkit/errors/classes/knotkiterror/)

## Properties

### failures

> `readonly` **failures**: [`WireFailureFactories`](/reference/knotkit/wire/type-aliases/wirefailurefactories/)<`Failure`>

Defined in: [packages/wire/src/artifact-format.ts:53](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/wire/src/artifact-format.ts#L53)

The module’s parse-error factory for every wire failure reason, for the wire guards and readers.

***

### serialize

> `readonly` **serialize**: (`build`, `options?`) => `Uint8Array`

Defined in: [packages/wire/src/artifact-format.ts:60](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/wire/src/artifact-format.ts#L60)

Run `build` and frame its payload under this format’s magic and payload version.

#### Parameters

##### build

() => [`ArtifactPayload`](/reference/knotkit/wire/interfaces/artifactpayload/)

##### options?

[`ArtifactSerializeOptions`](/reference/knotkit/wire/interfaces/artifactserializeoptions/)

#### Returns

`Uint8Array`

#### Throws

The module’s invalid-input error for every wire caller-contract failure raised by `build` or by the framing; any other error is rethrown untouched.

***

### deserialize

> `readonly` **deserialize**: (`value`) => [`ArtifactPayload`](/reference/knotkit/wire/interfaces/artifactpayload/)

Defined in: [packages/wire/src/artifact-format.ts:67](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/wire/src/artifact-format.ts#L67)

Validate untrusted input as this format’s envelope and return the module-owned bytes.

#### Parameters

##### value

`unknown`

#### Returns

[`ArtifactPayload`](/reference/knotkit/wire/interfaces/artifactpayload/)

#### Throws

The module’s parse error: `wrong-format` for a value that is not a `Uint8Array`, an envelope reason for malformed bytes, and `unsupported-payload-version` for another payload version.

***

### kindTag

> `readonly` **kindTag**: (`kind`) => `number`

Defined in: [packages/wire/src/artifact-format.ts:69](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/wire/src/artifact-format.ts#L69)

The byte `kind` is written as.

#### Parameters

##### kind

`Kind`

#### Returns

`number`

***

### kindOf

> `readonly` **kindOf**: (`tag`) => `Kind`

Defined in: [packages/wire/src/artifact-format.ts:75](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/wire/src/artifact-format.ts#L75)

The kind a header’s tag byte names.

#### Parameters

##### tag

`number`

#### Returns

`Kind`

#### Throws

The module’s `unknown-kind` parse error for a tag no kind is written as.
