View Source MyspaceIPFS.Files (Myspace IPFS v0.1.0)

MyspaceIPFS.Files is where the files commands of the IPFS API reside.

Link to this section Summary

Functions

Change the CID version or hash function of a path's root node.

Copy files into mfs.

Flush a given path's data to disk.

List directories in the local mutable namespace.

Make directories.

Move files.

Read a file in a given mfs.

Remove a file from mfs.

Get file status.

Write to a mutable file in a given filesystem.

Link to this section Functions

Link to this function

chcid(path \\ '/', opts \\ [])

View Source
@spec chcid(path(), opts()) :: okresult()

Change the CID version or hash function of a path's root node.

parameters

Parameters

path: The path to change the CID for.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-chcid

[
  cid-version: <int>, # CID version. (experimental)
  hash: <string>, # Hash function to use. Implies CID version 1 if used. (experimental)
]
Link to this function

cp(source, dest, opts \\ [])

View Source
@spec cp(fspath(), fspath(), opts()) :: okresult()

Copy files into mfs.

parameters

Parameters

source: The source file to copy. dest: The destination path for the file to be copied to.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-cp

[
  parents: <bool>, # Make parent directories as needed.
]

Flush a given path's data to disk.

parameters

Parameters

https://docs.ipfs.io/reference/http/api/#api-v0-files-flush path - The path to flush. If not specified, the entire repo will be flushed.

@spec flush(path()) :: okresult()
Link to this function

ls(path \\ '/', opts \\ [])

View Source
@spec ls(path(), opts()) :: okresult()

List directories in the local mutable namespace.

parameters

Parameters

path - The path to list. Defaults to /.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-ls

[
  l: <bool>, # Use long listing format.
  U: <bool>, # Do not sort; list entries in directory order.
]
@spec mkdir(path(), opts()) :: okresult()

Make directories.

parameters

Parameters

path - The path to make directories at.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-mkdir

[
  `parents` - <bool>, # No error if existing, make parent directories as needed.
  `hash` - <string>, # Hash function to use. Implies CID version 1 if used. (experimental)
  `cid-version` - <int>, # CID version. (experimental)
]
@spec mv(path(), path()) :: okresult()

Move files.

parameters

Parameters

source - The source file to move. dest - The destination path for the file to be moved to.

@spec read(path(), opts()) :: okresult()

Read a file in a given mfs.

parameters

Parameters

path - The path to the file to be read.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-read

[
  offset: <int>, # Byte offset to begin reading from.
  count: <int>, # Maximum number of bytes to read.
]
@spec rm(path(), opts()) :: okresult()

Remove a file from mfs.

parameters

Parameters

path - The path to the file to be removed.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-rm

[
  recursive: <bool>, # Recursively remove directories.
  force: <bool>, # Forcibly remove target at path; implies recursive for directories.
]
@spec stat(path(), opts()) :: okresult()

Get file status.

parameters

Parameters

path - The path to the file to stat.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-stat

[
  format: <string>, # Format to print out.
                    Allowed tokens:
                    <hash> <size> <cumulsize> <type> <childs>
  hash: <bool>, # Compute the hash of the file.
  size: <bool>, # Compute the size of the file.
  with-local: <bool>, # Compute the size of the file including the local repo.
]
Link to this function

write(data, path, opts \\ [])

View Source
@spec write(fspath(), path(), opts()) :: okresult()

Write to a mutable file in a given filesystem.

parameters

Parameters

path - The path to write to. data - The data to write.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-files-write

[
  create: <bool>, # Create the file if it does not exist.
  truncate: <bool>, # Truncate the file to size zero before writing.
  offset: <int>, # Byte offset to begin writing at.
  count: <int>, # Maximum number of bytes to write.
  raw-leaves: <bool>, # Use raw blocks for newly created leaf nodes. (experimental)
  cid-version: <int>, # CID version. (experimental)
  hash: <string>, # Hash function to use. Implies CID version 1 if used. (experimental)
  parents: <bool>, # No error if existing, make parent directories as needed.
]