# decodeBytesKey

> **decodeBytesKey**(`bytes`, `offset?`): readonly \[`Uint8Array`<`ArrayBufferLike`>, `number`]

Defined in: [packages/key-encoding/src/scalars.ts:202](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/key-encoding/src/scalars.ts#L202)

Decode one `encodeBytesKey` encoding at `offset`, returning the byte string and the offset after its terminator.

## Parameters

### bytes

`Uint8Array`

### offset?

`number`

## Returns

readonly \[`Uint8Array`<`ArrayBufferLike`>, `number`]

## Throws

`INVALID_KEY_VALUE` or `INVALID_OFFSET`, as [decodeUint32Key](/reference/knotkit/key-encoding/functions/decodeuint32key/).

## Throws

`TRUNCATED_KEY` when the bytes end before the terminator, `INVALID_ESCAPE_SEQUENCE` when a `0x00` is followed by a byte other than `0xff` or `0x00`, or `TRAILING_BYTES` as [decodeUint32Key](/reference/knotkit/key-encoding/functions/decodeuint32key/).
