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.
If true, instead of copying byte arrays return subarrays into CBOR buffer.
By default, false.
If true, allow only string and number keys for maps. Throw if encountered any other type.
By default, false.
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.
If true, map keys must be unique (after conversion to string). Throw if encountered duplicate keys.
By default, false.
Specifies options for encoder.
In JavaScript, object keys are strings, so by default CBOR encoding will produce string keys for maps.
Setting intKeys to true will make encoder first try to convert each object key to integer and encode it as such if conversion succeeds. Keys that cannot be converted will be encoded as strings. Note that if object contains both integer and string keys, the map will be encoded as such.
By default, false.
Tagged object encoders.
By default, DEFAULT_TAGGED_ENCODERS, which encodes Dates (as a string) and RegExps.
Pass empty array to disable tagged encoders.
Tagged value decoder.
If it can decode a Tagged value (by checking its tag property), it must return this value, otherwise must return undefined.
Tagged value encoder.
If it can encode the object, it must return a Tagged instance, otherwise must return undefined.
Default tagged values decoders.
Default tagged values encoders.
Decodes src from CBOR.
If noCopy is true, the returned Uint8Arrays will be a subarrays of src otherwise they will be newly allocated. It is not recommended to set it to true, due to the possibility of hard-to-detect bugs resulting from it and preventing chunks of memory from being garbage collected.
If ignoreExtraData is true, decoder will not throw an error if there's undecoded data at the end of the source.
Encodes the given value as CBOR.
Generated using TypeDoc
Specifies options for decoder.