View Source MyspaceIPFS.Api.Basic (Myspace IPFS v1.0.0-dev)
MyspaceIPFS.Api is where the main commands of the IPFS API reside.
TODO:
- Handle adding of directories.
- Getting files from IPFS.
Link to this section Summary
Functions
Add a file to IPFS.
Get the contents of a file from ipfs. Easy way to get the contents of a text file for instance.
Get a file or directory from IPFS. As it stands ipfs sends a text blob back, so we need to implement a way to get the file extracted and saved to disk.
List the files in an IPFS object.
Link to this section Types
@type fspath() :: MyspaceIPFS.fspath()
@type opts() :: MyspaceIPFS.opts()
@type path() :: MyspaceIPFS.path()
@type result() :: MyspaceIPFS.result()
Link to this section Functions
Add a file to IPFS.
options
Options
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-add
Opts are of the format
[
quiet: <bool>,
quieter: <bool>,
silent: <bool>,
progress: <bool>,
trickle: <bool>,
only-hash: <bool>,
wrap_with_directory: <bool>,
chunker: <string>,
pin: <bool>,
raw_leaves: <bool>,
cid_version: <int>,
hash: <string>,
inline: <bool>,
inline_limit: <int>,
to-files: <string>,
]
Get the contents of a file from ipfs. Easy way to get the contents of a text file for instance.
parameters
Parameters
path: The IPFS path name or cid of the file to get.
options
Options
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-cat
[
offset: <int>,
length: <int>,
timeout: <string>
]
Get a file or directory from IPFS. As it stands ipfs sends a text blob back, so we need to implement a way to get the file extracted and saved to disk.
parameters
Parameters
fspath: The filesystem path to the file to add.
options
Options
List the files in an IPFS object.
parameters
Parameters
path: The IPFS path name or cid of the object to list files from.
options
Options
https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-ls
example
Example
[
headers: <bool>,
resolve-type: <bool>,
stream: <bool>,
timeout: <string>
]