package cborl

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

OCaml implementation of The Concise Binary Object Representation (CBOR)

This module provides types for CBOR data items as well as function for writing CBOR data items to sequences of bytes and reading CBOR data items from sequences of bytes.

CBOR Data Item

type item =
  1. | Null
  2. | Undefined
  3. | Bool of bool
  4. | Integer of Z.t
  5. | ByteString of string
  6. | TextString of string
  7. | Array of item list
  8. | Map of (item * item) list
  9. | Tag of Z.t * item
  10. | Simple of int
  11. | Float of float
  12. | Double of float

Type of CBOR data item

val pp : item Fmt.t

CBOR data item pretty printer. Output resembles the CBOR diagnostic notation.

val equal : item -> item -> bool

equal a b returns true if a is structurally equal to b.

Serialization

val read : char Stdlib.Seq.t -> item

read bytes read a single CBOR data item from the sequence bytes.

To read multiple data items (i.e. a CBOR data stream) see Signal.to_items.

val write : item -> char Stdlib.Seq.t

write item returns a sequence of bytes that encodes item.

Signals

module Signal : sig ... end

Serialization is done by converting CBOR data items to a sequence of signals. Signals can be directly translated to and from bytes. This module provides direct access to signals. This can be used to stream large CBOR data items and also provides the ability to work with indefinite-length CBOR data items.

OCaml

Innovation. Community. Security.