cbor2
    Preparing search index...

    Interface CommentOptions

    Comment options on top of the decode options.

    interface CommentOptions {
        boxed?: boolean;
        cde?: boolean;
        convertUnsafeIntsToFloat?: boolean;
        createObject?: ObjectCreator;
        dcbor?: boolean;
        diagnosticSizes?: DiagnosticSizes;
        encoding?: null | "base64" | "hex";
        initialDepth?: number;
        maxDepth?: number;
        minCol: number;
        noPrefixHex?: boolean;
        preferMap?: boolean;
        pretty?: boolean;
        rejectBigInts?: boolean;
        rejectDuplicateKeys?: boolean;
        rejectFloats?: boolean;
        rejectInts?: boolean;
        rejectLargeNegatives?: boolean;
        rejectLongFloats?: boolean;
        rejectLongLoundNaN?: boolean;
        rejectNegativeZero?: boolean;
        rejectSimple?: boolean;
        rejectStreaming?: boolean;
        rejectStringsNotNormalizedAs?: null | StringNormalization;
        rejectSubnormals?: boolean;
        rejectUndefined?: boolean;
        rejectUnsafeFloatInts?: boolean;
        requirePreferred?: boolean;
        saveOriginal?: boolean;
        sortKeys?: null | KeySorter;
        tags?: null | TagDecoderMap;
    }

    Hierarchy (View Summary)

    Index

    Properties

    boxed?: boolean

    Should 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.

    false
    
    cde?: boolean

    Turn on options for draft-ietf-cbor-cde-05.

    convertUnsafeIntsToFloat?: boolean

    In 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.

    createObject?: ObjectCreator

    Create 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).

    dcbor?: boolean

    Turn on options for draft-mcnally-deterministic-cbor-11.

    diagnosticSizes?: DiagnosticSizes

    Should the size of an element always be appended to that element using an underscore when calling diagnose?

    DiagnosticSizes.PREFERRED
    
    encoding?: null | "base64" | "hex"

    If the input is a string, how should it be decoded into a byte stream? Ignored if the input is a Uint8Array.

    null
    
    initialDepth?: number

    For the root object, how many levels of nesting is it already? Happens with tag 24.

    0
    
    maxDepth?: number

    Maximum 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!

    1024
    
    minCol: number

    The '--' separating bytes from description must be in at least this column.

    0
    
    noPrefixHex?: boolean

    If true, don't add the initial 0xHEX line to comment output.

    false
    
    preferMap?: boolean

    Always 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.

    pretty?: boolean

    Pretty-print diagnostic format.

    false
    
    rejectBigInts?: boolean

    If there are bigint (tag 2/3) in the incoming data, exit with an error.

    false
    
    rejectDuplicateKeys?: boolean

    If 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.

    false
    
    rejectFloats?: boolean

    Reject 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.

    false
    
    rejectInts?: boolean

    Reject any mt 0/1 numbers. This might be used in profiles that expect all numbers to be encoded as floating point.

    false
    
    rejectLargeNegatives?: boolean

    Reject negative integers in the range [CBOR_NEGATIVE_INT_MAX ... STANDARD_NEGATIVE_INT_MAX - 1].

    false
    
    rejectLongFloats?: boolean

    Reject floating point numbers that should have been encoded in shorter form, including having been encoded as an integer.

    rejectLongLoundNaN?: boolean

    Reject NaNs that are not encoded as 0x7e00.

    false
    
    rejectNegativeZero?: boolean

    If negative zero (-0) is received, throw an error.

    false
    
    rejectSimple?: boolean

    Reject simple values other than true, false, undefined, and null.

    false
    
    rejectStreaming?: boolean

    Reject any attempt to decode streaming CBOR.

    false
    
    rejectStringsNotNormalizedAs?: null | StringNormalization

    Reject strings that are not normalized with the given normalization form. Don't use this without Unicode expertise.

    rejectSubnormals?: boolean

    Reject subnormal floating point numbers.

    false
    
    rejectUndefined?: boolean

    Reject the undefined simple value. Usually used with rejectSimple.

    false
    
    rejectUnsafeFloatInts?: boolean

    For dCBOR, reject "integers" between 2^53 and 2^64 that were encoded as floats.

    requirePreferred?: boolean

    Reject integers and lengths that could have been encoded in a smaller encoding.

    false
    
    saveOriginal?: boolean

    Save 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.

    sortKeys?: null | KeySorter

    If non-null, keys being decoded MUST be in this order. Note that this is a superset of rejectDuplicateKeys, and is slightly more efficient.

    null
    
    tags?: null | TagDecoderMap

    If non-null, prefer any tags in the map to ones have have been registered with Tag.registerDecoder.