Elixir-Ipfs-Api
The Elixir library that is used to communicate with the IPFS REST endpoint.
Examples
Getting the version of IPFS node
iex> conn = %IpfsConnection{}
iex> IpfsApi.version(conn)
{:ok, %{"Commit" => "", "Repo" => "2", "Version" => "0.3.10-dev"}}Adding content to IPFS
iex> conn = %IpfsConnection{}
iex> IpfsApi.add(conn, "Hello world from Elixir-Ipfs-Api")
{:ok,
%{"Hash" => "QmTcCZJEW1kUcYU1bKQk9SMGRsTisMMWXuxJ1AQerHwyaA",
"Name" => "QmTcCZJEW1kUcYU1bKQk9SMGRsTisMMWXuxJ1AQerHwyaA"}}Getting content from IPFS
iex> conn = %IpfsConnection{}
iex> IpfsApi.get(conn, "QmTcCZJEW1kUcYU1bKQk9SMGRsTisMMWXuxJ1AQerHwyaA")
<<81, 109, 84, 99, 67, 90, 74, 69, 87, 49, 107, 85, 99, 89, 85, 49, 98, 75, 81, 107, 57, 83, 77, 71, 82, 115, 84, 105, 115, 77, 77, 87, 88, 117, 120, 74, 49, 65, 81, 101, 114, 72, 119, 121, 97, 65, 0, 0, 0, 0, ...>>Available APIs
Basic commands
- add
- get
- cat
- ls
- refs
Data structure commands
- block_stat
- block_get
- block_put
- object_data
- object_links
- object_get
- object_put
- object_stat
- object_patch
- file_ls
Network commands
- id
- bootstrap
- swarm_peers
- swarm_addr
Tool commands
- config_show
- version
TODO
- Complete Advanced commands, networks commands & tool commands APIs
- Add stream for adding & getting files to and from IPFS
- Add a pool to request from multiple different IPFS nodes