Skip to content

Cbor.decode

Decodes CBOR (Concise Binary Object Representation) data into a JavaScript value.

Imports

Named
import { Cbor } from 'ox'

Examples

import { Cbor } from 'ox'
 
Cbor.decode('0x83010203')
[1, 2, 3]
Cbor.decode('0xa263666f6f636261726362617a83010203')
{ foo: 'bar', baz: [1, 2, 3] }
Cbor.decode(new Uint8Array([101, 104, 101, 108, 108, 111]))
'hello'

Definition

function decode<type>(
  data: Hex.Hex | Bytes.Bytes,
): type

Source: src/core/Cbor.ts

Parameters

data

  • Type: Hex.Hex | Bytes.Bytes

The CBOR-encoded data to decode.

Return Type

The decoded value.

type