View Source MyspaceIPFS.Dag (Myspace IPFS v0.2.0-alpha.2)

MyspaceIPFS.Dag is where the cid commands of the IPFS API reside.

Link to this section Summary

Types

A struct that represents the import of a DAG.

A struct that represents the root of an import of a DAG.

A struct that represents the stats of an import of a DAG.

Functions

Streams the selected DAG as a .car stream on stdout.

Get a DAG node.

Import the contents of a DAG.

Put an object to be encoded as a DAG object. There seems to be a bug in the IPFS API where the data is not being parsed correctly. Simple export can not be reimported at the moment.

Link to this section Types

@type import() :: %MyspaceIPFS.DagImport{root: import_root(), stats: import_stats()}

A struct that represents the import of a DAG.

%MyspaceIPFS.DagImport{
  root: %MyspaceIPFS.DagImportRoot{
    cid: MyspaceIPFS.SlashCID.t(),
    pin_error_msg: binary
  },
  stats: %MyspaceIPFS.DagImportStats{
    block_bytes_count: non_neg_integer(),
    block_count: non_neg_integer()
  }
}
@type import_root() :: %MyspaceIPFS.DagImportRoot{
  cid: MyspaceIPFS.slash_cid(),
  pin_error_msg: binary()
}

A struct that represents the root of an import of a DAG.

@type import_stats() :: %MyspaceIPFS.DagImportStats{
  block_bytes_count: integer() | nil,
  block_count: integer() | nil
}

A struct that represents the stats of an import of a DAG.

Link to this section Functions

@spec export(binary()) :: {:ok, any()} | MyspaceIPFS.Api.error_response()

Streams the selected DAG as a .car stream on stdout.

options

Options

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-dag-export

No options are relevant for this command.

@spec get(Path.t(), list()) :: {:ok, any()} | MyspaceIPFS.Api.error_response()

Get a DAG node.

options

Options

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-dag-get

Link to this function

import(data, opts \\ [])

View Source
@spec import(binary(), list()) :: {:ok, import()} | MyspaceIPFS.Api.error_response()

Import the contents of a DAG.

The IPFS API does not currently support posting data directly to the endpoint. So we have to write the data to a temporary file and then post that file.

options

Options

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-dag-import

Put an object to be encoded as a DAG object. There seems to be a bug in the IPFS API where the data is not being parsed correctly. Simple export can not be reimported at the moment.

options

Options

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-dag-put

[
  store-codec: "<string>", # Default: "dag-cbor"
  input-codec: "<string>", # Default: "dag-json"
  pin: "<bool>", # Whether to pin object when adding. Default: false
  hash: "<string>", # Hash function to use. Default: "sha2-256"
  allow-big-block: <bool>, # Allow blocks larger than 1MB. Default: false
]