# Cbor

Functions for encoding and decoding CBOR (Concise Binary Object Representation) data.

CBOR is a binary data format designed for compact data representation and efficient parsing.
It supports all JSON data types plus additional types like byte strings, tags, and simple values.

## Examples

### Encoding Values to CBOR

Values can be encoded to CBOR using [`Cbor.encode`](/api/Cbor/encode):

```ts twoslash
import { Cbor } from 'ox'

Cbor.encode({ foo: 'bar', baz: [1, 2, 3] })
// @log: '0xa263666f6f636261726362617a83010203'
```

### Decoding CBOR to Values

Values can be decoded from CBOR using [`Cbor.decode`](/api/Cbor/decode):

```ts twoslash
import { Cbor } from 'ox'

Cbor.decode('0xa263666f6f636261726362617a83010203')
// @log: { foo: 'bar', baz: [1, 2, 3] }
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Cbor.decode`](/api/Cbor/decode) | Decodes CBOR (Concise Binary Object Representation) data into a JavaScript value. |
| [`Cbor.encode`](/api/Cbor/encode) | Encodes a value into CBOR (Concise Binary Object Representation) format. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Cbor.ArrayTooLargeError`](/api/Cbor/errors#cborarraytoolargeerror) |  |
| [`Cbor.ByteStringTooLargeError`](/api/Cbor/errors#cborbytestringtoolargeerror) |  |
| [`Cbor.InvalidAdditionalInfoError`](/api/Cbor/errors#cborinvalidadditionalinfoerror) |  |
| [`Cbor.InvalidIndefiniteLengthChunkError`](/api/Cbor/errors#cborinvalidindefinitelengthchunkerror) |  |
| [`Cbor.InvalidMajorTypeError`](/api/Cbor/errors#cborinvalidmajortypeerror) |  |
| [`Cbor.InvalidSimpleValueError`](/api/Cbor/errors#cborinvalidsimplevalueerror) |  |
| [`Cbor.NumberTooLargeError`](/api/Cbor/errors#cbornumbertoolargeerror) |  |
| [`Cbor.ObjectTooLargeError`](/api/Cbor/errors#cborobjecttoolargeerror) |  |
| [`Cbor.StringTooLargeError`](/api/Cbor/errors#cborstringtoolargeerror) |  |
| [`Cbor.UnexpectedTokenError`](/api/Cbor/errors#cborunexpectedtokenerror) |  |
| [`Cbor.Unsupported64BitIntegerError`](/api/Cbor/errors#cborunsupported64bitintegererror) |  |
| [`Cbor.UnsupportedBigIntError`](/api/Cbor/errors#cborunsupportedbiginterror) |  |
| [`Cbor.UnsupportedTagError`](/api/Cbor/errors#cborunsupportedtagerror) |  |
