DecoderOptions: {
    ignoreExtraData?: boolean;
    maxArrayLength?: number;
    maxByteLength?: number;
    maxDepth?: number;
    maxIndefiniteLength?: number;
    maxMapLength?: number;
    noCopy?: boolean;
    strictMapKeys?: boolean;
    taggedDecoders?: TaggedDecoder<any>[];
    uniqueMapKeys?: boolean;
}

Specifies options for decoder.

Type declaration

  • OptionalignoreExtraData?: boolean

    If true, ignore extra data at the end of the source buffer. Otherwise, decoder throws an error if extra data is detected.

    To get the number of extra bytes left, use undecodedLength.

    By default, false.

  • OptionalmaxArrayLength?: number

    Maximum allowed length of arrays (number of items).

    By default, unlimited.

  • OptionalmaxByteLength?: number

    Maximum allowed byte length of bytes or strings.

    By default, unlimited.

  • OptionalmaxDepth?: number

    Maximum allowed depth of nested structures (arrays and maps). If exceeded, decoder throws an error.

    By default, 128.

  • OptionalmaxIndefiniteLength?: number

    Maximum allowed length of indefinite-length items (bytes, strings, arrays, maps).

    Can be set to 0 to disallow indefinite-length items.

    maxArrayLength, maxMapLength and maxByteLength options, if set, still apply.

    If exceeded, decoder throws an error.

    By default, unlimited.

  • OptionalmaxMapLength?: number

    Maximum allowed length of maps (number of key-value pairs).

    By default, unlimited.

  • OptionalnoCopy?: boolean

    If true, instead of copying byte arrays return subarrays into CBOR buffer.

    By default, false.

  • OptionalstrictMapKeys?: boolean

    If true, allow only string and number keys for maps. Throw if encountered any other type.

    By default, false.

  • OptionaltaggedDecoders?: TaggedDecoder<any>[]

    Tagged object decoders.

    By default, DEFAULT_TAGGED_DECODERS, which converts tagged Tags.DateString and Tags.DateNumber to Date and Tags.RegExp to RegExp objects.

    Pass empty array to disable tagged decoders.

  • OptionaluniqueMapKeys?: boolean

    If true, map keys must be unique (after conversion to string). Throw if encountered duplicate keys.

    By default, false.