Optional
boxedShould numbers and strings be created as boxed instances, which retain their original encoding for round-tripping? If this is true, saveOriginal is also set to true. Think of this as "saveOriginal + extras". The thought is that most use cases for saveOriginal will want the original encoding of an object or array, and won't care about the original encoding of strings and numbers. Turning this on also has the side-effect of making all CBOR maps decode as JS Map objects, rather than plain Objects.
Optional
cdeTurn on options for draft-ietf-cbor-cde-05.
Optional
convertIn dCBOR, JS numbers between 2^53 and 2^64 get encoded as CBOR integers. When decoding, present them as JS numbers instead of BigInt, losing accuracy.
Optional
createCreate an object from an array of key-value pairs. The default implementation creates a plain JS object if all of the keys are strings, otherwise creates a Map (unless preferMap or boxed is set, in which case a Map is always created).
Optional
dcborTurn on options for draft-mcnally-deterministic-cbor-11.
Optional
diagnosticShould the size of an element always be appended to that element using an underscore when calling diagnose?
Optional
encodingIf the input is a string, how should it be decoded into a byte stream? Ignored if the input is a Uint8Array.
Optional
maxMaximum allowed depth to parse into CBOR structures. This limit is security-relevant for untrusted inputs. May be set to Infinity for trusted inputs, but be careful!
Optional
preferAlways generate Map instances when decoding, instead of trying to generate object instances when all of the keys are strings. If you have the boxed option on, this option has no effect, and Maps are always produced.
Optional
prettyPretty-print diagnostic format.
Optional
rejectIf there are bigint (tag 2/3) in the incoming data, exit with an error.
Optional
rejectIf there are duplicate keys in a map, should we throw an exception? Note: this is more compute-intensive than expected at the moment, but that will be fixed eventually.
Optional
rejectReject any floating point numbers. This might be used in profiles that are not expecting floats to prevent one from being coerced to an integer-looking number without the receiver knowing.
Optional
rejectReject any mt 0/1 numbers. This might be used in profiles that expect all numbers to be encoded as floating point.
Optional
rejectReject negative integers in the range [CBOR_NEGATIVE_INT_MAX ... STANDARD_NEGATIVE_INT_MAX - 1].
Optional
rejectReject floating point numbers that should have been encoded in shorter form, including having been encoded as an integer.
Optional
rejectReject NaNs that are not encoded as 0x7e00.
Optional
rejectIf negative zero (-0) is received, throw an error.
Optional
rejectReject simple values other than true, false, undefined, and null.
Optional
rejectReject any attempt to decode streaming CBOR.
Optional
rejectReject strings that are not normalized with the given normalization form. Don't use this without Unicode expertise.
Optional
rejectReject subnormal floating point numbers.
Optional
rejectReject the undefined
simple value. Usually used with rejectSimple.
Optional
rejectFor dCBOR, reject "integers" between 2^53 and 2^64 that were encoded as floats.
Optional
requireReject integers and lengths that could have been encoded in a smaller encoding.
Optional
saveSave the original bytes associated with every object as a property of
that object. Use getEncoded(obj)
to retrieve the associated bytes.
If you need the original encoded form of primitive items such as numbers
and strings, set boxed: true
as well.
Optional
sortIf non-null, keys being decoded MUST be in this order. Note that this is a superset of rejectDuplicateKeys, and is slightly more efficient.
Decoding options.