Elixir CBOR

An implementation of of RFC 7049 Concise Binary Object Representation (CBOR) for Elixir.

This is alpha quality software. Only a small subset of types are supported. Use at your own risk. excbor looks like it’s no longer maintained. If anyone else has a more fully feaured implementation of CBOR in Elixir open an issue and I’ll get the repo and package transferred.

Installation

If available in Hex, the package can be installed by adding cbor to your list of dependencies in mix.exs:

def deps do
  [
    {:cbor, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/cbor.

Usage

iex(2)> bytes = Cbor.encode(%{array: [1,2,3], map: %{key: :value}, string: :string})
<<163, 102, 115, 116, 114, 105, 110, 103, 102, 115, 116, 114, 105, 110, 103, 99, 109, 97, 112, 161, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 101, 97, 114, 114, 97, 121, 131, 1, 2, 3>>
iex(3)> Cbor.decode(bytes)
%{array: [1, 2, 3], map: %{key: :value}, string: :string}