{"route":"/en-US-v0.13.1/reference/data-loading/cbor/","title":"CBOR","description":"Documentation for the `cbor` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-source","name":"source","children":[]}]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-decode","name":"Decode CBOR","children":[{"id":"definitions-decode-data","name":"data","children":[]}]},{"id":"definitions-encode","name":"Encode CBOR","children":[{"id":"definitions-encode-value","name":"value","children":[]}]}]}],"body":{"kind":"func","content":{"path":[],"name":"cbor","title":"CBOR","keywords":[],"oneliner":"Reads structured data from a CBOR file.","element":false,"contextual":false,"deprecation":null,"details":"<p>Reads structured data from a CBOR file.</p>\n<p>The file must contain a valid CBOR serialization. Mappings will be\nconverted into Typst dictionaries, and sequences will be converted into\nTypst arrays. Strings and booleans will be converted into the Typst\nequivalents, null-values (<code>null</code>, <code>~</code> or empty ``) will be converted into\n<code><span class=\"typ-key\">none</span></code>, and numbers will be converted to floats or integers depending on\nwhether they are whole numbers.</p>\n<p>Be aware that integers larger than 2<sup>63</sup>-1 will be converted to\nfloating point numbers, which may result in an approximative value.</p>","example":null,"self":false,"params":[{"name":"source","details":"<p>A <a href=\"/en-US-v0.13.1/reference/syntax/#paths\">path</a> to a CBOR file or raw CBOR bytes.</p>","example":null,"types":["str","bytes"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["any"],"scope":[{"path":["cbor"],"name":"decode","title":"Decode CBOR","keywords":[],"oneliner":"Reads structured data from CBOR bytes.","element":false,"contextual":false,"deprecation":"`cbor.decode` is deprecated, directly pass bytes to `cbor` instead","details":"<p>Reads structured data from CBOR bytes.</p>","example":null,"self":false,"params":[{"name":"data","details":"<p>CBOR data.</p>","example":null,"types":["bytes"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["any"],"scope":[]},{"path":["cbor"],"name":"encode","title":"Encode CBOR","keywords":[],"oneliner":"Encode structured data into CBOR bytes.","element":false,"contextual":false,"deprecation":null,"details":"<p>Encode structured data into CBOR bytes.</p>","example":null,"self":false,"params":[{"name":"value","details":"<p>Value to be encoded.</p>","example":null,"types":["any"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["bytes"],"scope":[]}]}}}