Skip to main content
Module

x/cbor_redux/mod.ts

The Concise Binary Object Representation (CBOR) data format (RFC7049) implemented in pure JavaScript, revived.
Latest
import * as cborRedux from "https://deno.land/x/cbor_redux@1.0.0/mod.ts";

Classes

Class for containing a CBOR Sequence; used for encoding and decoding.

Class for structuring a simple value. Unassigned or reserved simple values are emitted as an instance of this class during decoding. This allows an application to handle custom decoding in the reviver function of the decoder.

Class for structuring a tagged value. Tags which are not JavaScript typed arrays are emitted as an instance of this class during decoding. This allows an application to handle tagged values in the reviver function of the decoder. Values which are a valid CBOR type will be decoded and assigned to the TaggedValue.value property.

Variables

An intrinsic object that provides functions to convert JavaScript values to and from the Concise Binary Object Representation (CBOR) format.

A symbol which is emitted by the reviver and replacer functions when a value is not associated with a key or CBOR label. In JSON, a value with no key simply emits an empty string; this would be indistinguishable from a valid CBOR data sequence. Using a symbol acheives emitting a comparable value without the value being a valid CBOR data type.

A symbol which may be returned by the user in the encoder's replacer function to omit values. Just like detecting an empty key, using a symbol acheives emitting a comparable value without the value being a valid CBOR data type. Use this in a custom replacer function as the return value to indicate to the encoder that the value is to be skipped from arrays and dictionaries.

Functions

Alias of encode. Converts a JavaScript value to a Concise Binary Object Representation (CBOR) buffer.

Converts a Concise Binary Object Representation (CBOR) buffer into an object.

Converts a JavaScript value to a Concise Binary Object Representation (CBOR) buffer.

Alias of decode. Converts a Concise Binary Object Representation (CBOR) buffer into an object.

Interfaces

Options for the decoder.

Narrow options for the decoder when using CBOR Sequences.

Type Aliases

A function to modify the behavior of the encoder; to omit values, return the OMIT_VALUE symbol.

A function to modify values which are encountered during decoding.

Indicates that the decorder should use either Object or Map as the key/value dictionary.

Indicates that the decoder should loosely accept all keys, striictly fail on duplicate keys, or strictly decode CBOR Sequences (RFC 8742).