Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "cbor/cbor"

Index

Type aliases

DecoderOptions

DecoderOptions: object

Specifies options for decoder.

Type declaration

EncoderOptions

EncoderOptions: object

Specifies options for encoder.

Type declaration

TaggedDecoder

TaggedDecoder: function

Tagged value decoder.

If it can decode a Tagged value (by checking its tag property), it must return this value, otherwise must return undefined.

Type declaration

    • (tagged: Tagged): T | undefined
    • Parameters

      Returns T | undefined

TaggedEncoder

TaggedEncoder: function

Tagged value encoder.

If it can encode the object, it must return a Tagged instance, otherwise must return undefined.

Type declaration

    • (obj: T | any): Tagged | undefined
    • Parameters

      • obj: T | any

      Returns Tagged | undefined

Variables

DEFAULT_TAGGED_DECODERS

DEFAULT_TAGGED_DECODERS: TaggedDecoder<any>[] = [DateStringDecoder,DateNumberDecoder,RegExpDecoder]

Default tagged values decoders.

DEFAULT_TAGGED_ENCODERS

DEFAULT_TAGGED_ENCODERS: TaggedEncoder<any>[] = [DateStringEncoder,RegExpEncoder]

Default tagged values encoders.

Functions

DateNumberDecoder

  • DateNumberDecoder(__namedParameters: object): Date

DateNumberEncoder

  • DateNumberEncoder(date: object | Date): Tagged

DateStringDecoder

  • DateStringDecoder(__namedParameters: object): Date

DateStringEncoder

  • DateStringEncoder(date: object | Date): Tagged

RegExpDecoder

  • RegExpDecoder(__namedParameters: object): RegExp
  • Parameters

    • __namedParameters: object

    Returns RegExp

RegExpEncoder

  • RegExpEncoder(rx: object | RegExp): Tagged

decode

  • decode(src: Uint8Array, options?: DecoderOptions): any | null | undefined
  • 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.

    Parameters

    Returns any | null | undefined

encode

  • encode(value: any | null | undefined, options?: EncoderOptions): Uint8Array
  • Encodes the given value as CBOR.

    Parameters

    Returns Uint8Array

Object literals

DEFAULT_DECODER_OPTIONS

DEFAULT_DECODER_OPTIONS: object

ignoreExtraData

ignoreExtraData: boolean = false

noCopy

noCopy: boolean = false

taggedDecoders

taggedDecoders: Array<function> = DEFAULT_TAGGED_DECODERS

DEFAULT_ENCODER_OPTIONS

DEFAULT_ENCODER_OPTIONS: object

intKeys

intKeys: boolean = false

taggedEncoders

taggedEncoders: Array<function> = DEFAULT_TAGGED_ENCODERS

Generated using TypeDoc