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:
import { Cbor } from 'ox'
Cbor.encode({ foo: 'bar', baz: [1, 2, 3] })
'0xa263666f6f636261726362617a83010203'Decoding CBOR to Values
Values can be decoded from CBOR using Cbor.decode:
import { Cbor } from 'ox'
Cbor.decode('0xa263666f6f636261726362617a83010203')
{ foo: 'bar', baz: [1, 2, 3] }Functions
| Name | Description |
|---|---|
Cbor.decode | Decodes CBOR (Concise Binary Object Representation) data into a JavaScript value. |
Cbor.encode | Encodes a value into CBOR (Concise Binary Object Representation) format. |

