ExIpfs.Cid (Elixir IPFS v0.2.1)

Copy Markdown View Source

ExIpfs.Cid is where the cid commands of the IPFS API reside.

Summary

Types

A v1 CID. This is the new Base32 CID format, which is likely to last and is preferred.

Functions

Convert to base32 CID version 1.

List available multibase encodings.

List available CID codecs.

Format and convert a CID in various useful ways.

List available Multihashes.

Types

base32cid()

@type base32cid() :: %ExIpfs.CidBase32CID{
  cid_str: binary(),
  error_msg: binary(),
  formatted: binary()
}

A v1 CID. This is the new Base32 CID format, which is likely to last and is preferred.

Functions

base32(cid)

@spec base32(binary()) :: {:ok, base32cid()} | ExIpfs.Api.error_response()

Convert to base32 CID version 1.

Parameters

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-cid-base32 cid - The CID to convert to base32.

bases(opts \\ [])

@spec bases(list()) :: {:ok, list()} | ExIpfs.Api.error_response()

List available multibase encodings.

codecs(opts \\ [])

@spec codecs(list()) :: {:ok, [ExIpfs.multi_codec()]} | ExIpfs.Api.error_response()

List available CID codecs.

Options

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-cid-codecs

  • numeric <bool> - Also include numeric codes.
  • supported <bool> - List only codecs supported by Kubo commands.

format(cid, opts \\ [])

@spec format(binary(), list()) :: {:ok, any()} | ExIpfs.Api.error_response()

Format and convert a CID in various useful ways.

Parameters

cid - The CID to format and convert.

Options

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-cid-format

  • f <string> - printf style format string. Default: %s.
  • v <string> - CID version.
  • b <string> - Multibase to display CID in.
  • mc <string> - Multicodec.

hashes(opts \\ [])

@spec hashes(list()) :: {:ok, [ExIpfs.multi_hash()]} | ExIpfs.Api.error_response()

List available Multihashes.

Options

https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-cid-hashes

  • numeric <bool> - Also include numeric codes.
  • supported <bool> - Show only supported hashes.