Show / Hide Table of Contents

Interface IFileSystemApi

Manages the files/directories in IPFS.

Namespace: Ipfs.CoreApi
Assembly: Ipfs.Core.dll
Syntax
public interface IFileSystemApi

Methods

| Improve this Doc View Source

AddAsync(Stream, String, AddFileOptions, CancellationToken)

Add a Stream to interplanetary file system.

Declaration
Task<IFileSystemNode> AddAsync(Stream stream, string name = "", AddFileOptions options = null, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Stream stream

The stream of data to add to IPFS.

String name

A name for the stream.

AddFileOptions options

The options when adding data to the IPFS file system.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IFileSystemNode>

A task that represents the asynchronous operation. The task's value is the data's node.

| Improve this Doc View Source

AddDirectoryAsync(String, Boolean, AddFileOptions, CancellationToken)

Add a directory and its files to the interplanetary file system.

Declaration
Task<IFileSystemNode> AddDirectoryAsync(string path, bool recursive = true, AddFileOptions options = null, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

The path to directory.

Boolean recursive

true to add sub-folders.

AddFileOptions options

The options when adding data to the IPFS file system.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IFileSystemNode>

A task that represents the asynchronous operation. The task's value is the directory's node.

| Improve this Doc View Source

AddFileAsync(String, AddFileOptions, CancellationToken)

Add a local file to the interplanetary file system.

Declaration
Task<IFileSystemNode> AddFileAsync(string path, AddFileOptions options = null, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

The name of the local file.

AddFileOptions options

The options when adding data to the IPFS file system.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IFileSystemNode>

A task that represents the asynchronous operation. The task's value is the file's node.

| Improve this Doc View Source

AddTextAsync(String, AddFileOptions, CancellationToken)

Add some text to the interplanetary file system.

Declaration
Task<IFileSystemNode> AddTextAsync(string text, AddFileOptions options = null, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String text

The string to add to IPFS. It is UTF-8 encoded.

AddFileOptions options

The options when adding data to the IPFS file system.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IFileSystemNode>

A task that represents the asynchronous operation. The task's value is the text's node.

| Improve this Doc View Source

GetAsync(String, Boolean, CancellationToken)

Download IPFS objects as a TAR archive.

Declaration
Task<Stream> GetAsync(string path, bool compress = false, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

An IPFS path to an existing file or directory, such as "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about" or "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V"

Boolean compress

If true, the returned stream is compressed with the GZIP algorithm.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Stream>

A task that represents the asynchronous operation. The task's value is a Stream containing a TAR archive.

Remarks

The returned TAR Stream must be disposed.

If the path is a directory, then all files and all sub-directories are returned; e.g. it is recursive.

| Improve this Doc View Source

ListFileAsync(String, CancellationToken)

Get information about the file or directory.

Declaration
Task<IFileSystemNode> ListFileAsync(string path, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

A path to an existing file or directory, such as "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about" or "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V"

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IFileSystemNode>

A task that represents the asynchronous operation. The task's value is an IFileSystemNode The DataBytes and DataStream are set to null.

| Improve this Doc View Source

ReadAllTextAsync(String, CancellationToken)

Reads the content of an existing IPFS file as text.

Declaration
Task<string> ReadAllTextAsync(string path, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

A path to an existing file, such as "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about" or "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V"

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<String>

A task that represents the asynchronous operation. The task's value is the contents of the path as a String.

| Improve this Doc View Source

ReadFileAsync(String, Int64, Int64, CancellationToken)

Reads an existing IPFS file with the specified offset and length.

Declaration
Task<Stream> ReadFileAsync(string path, long offset, long count = 0L, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

Am IPFS path to an existing file, such as "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about" or "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V"

Int64 offset

The position to start reading from.

Int64 count

The number of bytes to read. If zero, then the remaining bytes from offset are read. Defaults to zero.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Stream>

A task that represents the asynchronous operation. The task's value is a Stream to the file contents.

Remarks

The returned Stream must be disposed.

| Improve this Doc View Source

ReadFileAsync(String, CancellationToken)

Reads an existing IPFS file.

Declaration
Task<Stream> ReadFileAsync(string path, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

An IPFS path to an existing file, such as "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about" or "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V"

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Stream>

A task that represents the asynchronous operation. The task's value is a Stream to the file contents.

Remarks

The returned Stream must be disposed.

See Also

Files API spec
  • Improve this Doc
  • View Source
Back to top Generated by DocFX