Skip to content

Latest commit

 

History

History
35 lines (31 loc) · 773 Bytes

README.md

File metadata and controls

35 lines (31 loc) · 773 Bytes

CBOR (Concise Binary Object Representation)

The CBOR library provides functions to encode and decode data in CBOR format, which is a compact data format designed for efficient data exchange.

import CBOR "mo:core/cbor/CBOR";

Interface

module {
  type Value = {
    #Array : [Value];
    #BigNumber : { #Negative : Int; #Positive : Nat };
    #Bool : Bool;
    #Break;
    #ByteString : Blob;
    #Float : FloatingPoint;
    #Infinity : Infinity;
    #Map : [(Value, Value)];
    #NaN : NaN;
    #NegativeInteger : Int;
    #Null;
    #Simple : Nat8;
    #Tag : { tag : Nat64; value : Value };
    #TextString : Text;
    #Undefined;
    #UnsignedInteger : Nat64;
  };
  decode : Blob -> Result<Value, Text>;
  encode : Value -> Blob;
};