Decode a CBOR-encoded buffer to a value.
cbor.decode(cbor: ArrayBuffer | ArrayBufferView)
ArrayBuffer or ArrayBufferView
A byte buffer containing a CBOR-encoded value.
Encode a value (primitive or object) to a CBOR buffer.
|number or Number
|signed or unsigned integer or floating point (1)
|string or String
|text string (utf-8)
|boolean or Boolean
|true or false
|ArrayBuffer or ArrayBufferView
|map (with string keys)
Other types are not allowed.
NOTE (1): If
true, the value is encoded as an integer, else it is encoded as a floating point number. Because floating point numbers may also be integers, a special wrapper object, Float, is provided. When serializing a wrapped number, the floating point type will always be used, regardless of whether
cbor.encode(2.0)will produce the encoding for a positive integer with value
cbor.encode(new cbor.Float(2.0))will produce the encoding for a floating point number with value
Circular references are not allowed.
The serialization order of object properties to a CBOR map is not specified.
Value to encode.
Wrapper for integers that should be encoded as floating point numbers.
Wrapped integer value.