View Source MyspaceIPFS.Block (Myspace IPFS v0.2.0-alpha.2)
MyspaceIPFS.Block is where the block commands of the IPFS API reside.
Link to this section Summary
Types
A structure from the API that is an error and its hash.
A structure from the API that is a key and its size.
Functions
Get a raw IPFS block.
Put data as an IPFS block.
Put file as an IPFS block.
Remove a block from the blockstore.
Get block stat.
Link to this section Types
A structure from the API that is an error and its hash.
@type key_size() :: %MyspaceIPFS.BlockKeySize{key: binary(), size: non_neg_integer()}
A structure from the API that is a key and its size.
Link to this section Functions
@spec get(binary()) :: {:ok, bitstring()} | MyspaceIPFS.Api.error_response()
Get a raw IPFS block.
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-block-get
parameters
Parameters
cid
- The CID of the block to get.
@spec put(any(), list()) :: {:ok, key_size()} | MyspaceIPFS.Api.error_response()
Put data as an IPFS block.
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-block-put
parameters
Parameters
data
- The data to be stored as a block.
options
Options
[
'cid-codec': <string>, # CID codec to use.
'mhtype': <string>, # Hash function to use.
'mhlen': <int>, # Hash length.
'pin': <bool>, # Pin added blocks recursively.
'allow-big-block': <bool>, # Allow blocks larger than 1MiB.
]
@spec put_file(Path.t(), list()) :: {:ok, key_size()} | MyspaceIPFS.Api.error_response()
Put file as an IPFS block.
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-block-put
parameters
Parameters
fspath
- The path to the file to be stored as a block.
options
Options
[
'cid-codec': <string>, # CID codec to use.
'mhtype': <string>, # Hash function to use.
'mhlen': <int>, # Hash length.
'pin': <bool>, # Pin added blocks recursively.
'allow-big-block': <bool>, # Allow blocks larger than 1MiB.
]
@spec rm(binary()) :: {:ok, error_hash()} | MyspaceIPFS.Api.error_response()
Remove a block from the blockstore.
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-block-rm
parameters
Parameters
cid
- The CID of the block to remove.
options
Options
[
'force': <bool>, # Ignore nonexistent blocks.
'quiet': <bool>, # Write minimal output.
]
@spec stat(binary()) :: {:ok, key_size()} | MyspaceIPFS.Api.error_response()
Get block stat.
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-block-stat
parameters
Parameters
cid
- The CID of the block to stat.