View Source MyspaceIPFS (Myspace IPFS v1.0.0-dev)

IPFS (the InterPlanetary File Syste new hypermedia distribution protocol, addressed by content and identities. IPFS enables the creation of completely distributed applications. It aims to make the web faster, safer, and more open.

IPFS is a distributed file system that seeks to connect all computing devices with the same system of files. In some ways, this is similar to the original aims of the Web, but IPFS is actually more similar to a single bittorrent swarm exchanging git objects.

Some code based on https://github.com/tableturn/ipfs/blob/master/lib/ipfs.ex

Link to this section Summary

Types

The structure of a normal error response from the node.

The file system path to the file to be sent to the node.

The structure of a normal response from the node.

The name of the file or data to be sent to the node.

The options to be sent to the node. These are dependent on the endpoint

The path to the endpoint to be hit. For example, /add or /cat. It's called path because sometimes the MultiHash is not enough to identify the resource, and a path is needed, eg. /ipns/myspace.bahner.com

The structure of a JSON response from the node.

Functions

High level function allowing to send file contents to the node. A path has to be specified along with the fspath to be sent. Also, a list of opts can be optionally sent.

High level function allowing to perform POST requests to the node. A path has to be provided, along with an optional list of opts that are dependent on the endpoint that will get hit. NB! This is not a GET request, but a POST request. IPFS uses POST requests.

Link to this section Types

@type error() :: {:error, Tesla.Env.t()}

The structure of a normal error response from the node.

@type fspath() :: String.t()

The file system path to the file to be sent to the node.

@type mapped() :: {:ok, [map()]} | {:error, Tesla.Env.t()}

The structure of a normal response from the node.

@type name() :: String.t()

The name of the file or data to be sent to the node.

@type opts() :: list()

The options to be sent to the node. These are dependent on the endpoint

@type path() :: String.t()

The path to the endpoint to be hit. For example, /add or /cat. It's called path because sometimes the MultiHash is not enough to identify the resource, and a path is needed, eg. /ipns/myspace.bahner.com

@type result() :: {:ok, any()} | {:error, Tesla.Env.t()}

The structure of a JSON response from the node.

Link to this section Functions

Link to this function

post_file(path, fspath, opts \\ [])

View Source
@spec post_file(path(), fspath(), opts()) :: result()

High level function allowing to send file contents to the node. A path has to be specified along with the fspath to be sent. Also, a list of opts can be optionally sent.

Link to this function

post_query(path, opts \\ [])

View Source
@spec post_query(path(), opts()) :: result()

High level function allowing to perform POST requests to the node. A path has to be provided, along with an optional list of opts that are dependent on the endpoint that will get hit. NB! This is not a GET request, but a POST request. IPFS uses POST requests.