# ExIpfsIpld

[![IPLD unit and integration tests](](
[![Coverage Status](](

Elixir IPLD module. IPLD is linked data, so that you can build tree structures built up of discrete units (DAG). To learn more about IPLD visit

You can for example add a pseudo structure like:

{"Key": "Value", "List": [0, 1, 2, 3, 4, 5, 6]}
And add it to IPFS like this:

iex(8)> json_string = "{\"Key\": \"Value\", \"List\": [0, 1, 2, 3, 4, 5, 6]}"
iex(9)> ExIpfsIpld.put(json_string)
 %ExIpfs.Link{/: "bafyreiflv5ldmhgxcdrixvdmh3sqoskooub76obvqwiabcekhvapk2kadi"}}
Iex(10)> ExIpfsIpld.get("bafyreiflv5ldmhgxcdrixvdmh3sqoskooub76obvqwiabcekhvapk2kadi/List/1")
{:ok, 1}

The data is structured, so that you can query the elements in the original data and data can be linked, like this:

iex(19)> readme_ref = %{"Link": %{"/": "bafyreiflv5ldmhgxcdrixvdmh3sqoskooub76obvqwiabcekhvapk2kadi"}}
%{Link: %{/: "bafyreiflv5ldmhgxcdrixvdmh3sqoskooub76obvqwiabcekhvapk2kadi"}}
iex(20)> ExIpfsIpld.put(Jason.encode!(readme_ref))
 %ExIpfs.Link{/: "bafyreifwbyb5niiy2znptlz4cnltyo24pc2mlzjalfh7e2vlwy4wjvzdte"}}
iex(21)> ExIpfsIpld.get("bafyreifwbyb5niiy2znptlz4cnltyo24pc2mlzjalfh7e2vlwy4wjvzdte/Link/Key")
{:ok, "Value"}

That's pretty cool :-)

## Installation

If [available in Hex](, the package can be installed
by adding `ex_pfs_ipld` to your list of dependencies in `mix.exs`:

def deps do
    :ex_ipfs_ipld, "~> 0.0.1"}

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at <>.