Documentation

cborGo to source

Reads structured data from a CBOR file.

The file must contain a valid CBOR serialization. The CBOR values will be converted into corresponding Typst values as listed in the table below.

The function returns a dictionary, an array or, depending on the CBOR file, another CBOR data type.

Conversion details

CBOR valueConverted into Typst
integerint (or float)
bytesbytes
floatfloat
textstr
boolbool
nullnone
arrayarray
mapdictionary
Typst valueConverted into CBOR
types that can be converted from CBORcorresponding CBOR value
symboltext
contenta map describing the content
other types (length, etc.)text via repr

Notes

Parameters

cbor(strpathbytes) → any

source
str or path or bytes
RequiredPositional
Question mark

A path to a CBOR file or raw CBOR bytes.

Definitions
Question mark

encodeGo to source

Encode structured data into CBOR bytes.

cbor.encode(any) → bytes

value
any
RequiredPositional
Question mark

Value to be encoded.