Skip to main content

Interface IMetaFileSystemClient

The MetaFileSystemClient is used to retrieve files and directories from Xperiflow

Namespace: Workspace.XBR.Xperiflow.MetaFileSystem

Assembly: Xperiflow.dll

Declaration
public interface IMetaFileSystemClient

Methods

DirectoryExistsAsync(string, CancellationToken)

Checks if a directory exists in the Meta FileSystem at the provided path.

Declaration
Task<bool> DirectoryExistsAsync(string path, CancellationToken cancellationToken = default)
Returns

Task<System.Boolean>

Parameters
TypeNameDescription
System.StringpathThe path to the directory. If the directory path.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetDirectoryMetadataAsync(string, bool, CancellationToken)

Retrieves only the metadata of a directory (no subdirectories or subfiles) from the Meta FileSystem.

Declaration
Task<IDirectoryMetadata?> GetDirectoryMetadataAsync(string path, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns

Task< Workspace.XBR.Xperiflow.MetaFileSystem.IDirectoryMetadata >

DirectoryMetadata

Parameters
TypeNameDescription
System.StringpathThe path to the folder. If the folder path does not exist, an error will be thrown.
System.BooleanerrorWhenDoesNotExistWhether or not to throw an error when the directory does not exist. Defaults to true.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetDirectoryAsync(string, int?, bool, bool, CancellationToken)

Retrieves a directory and its subcontents (other file and folders metdata) from the Meta FileSystem.

Declaration
Task<IDirectoryContent?> GetDirectoryAsync(string path, int? maxDepth = 1, bool includeDirectories = true, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns

Task< Workspace.XBR.Xperiflow.MetaFileSystem.IDirectoryContent >

DirectoryContent: This holds accessors to files and directory subcontents.

Parameters
TypeNameDescription
System.StringpathThe path to the folder. If the folder path does not exist, an error will be thrown.
System.Nullable<System.Int32>maxDepthThe max depth of subcontents to grab. Defaults to 1 level deep of subcontents. Set to -1 or null to grab all subcontents.
System.BooleanincludeDirectoriesWhether or not to include subfolders in the subcontents. Defaults to true.
System.BooleanerrorWhenDoesNotExistWhether or not to throw an error when the directory does not exist. Defaults to true.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

MakeDirectoriesAsync(string, bool, CancellationToken)

Makes one or more directories in the Meta FileSystem at the provided path.

Note that this method is subject to runtime checks that may not allow the creation of directories in certain locations.

Declaration
Task MakeDirectoriesAsync(string path, bool existsOk = false, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringpathThe directory path to create.
System.BooleanexistsOkControls whether or not to throw an error if the directory already exists. Defaults to false.
System.Threading.CancellationTokencancellationToken

RemoveDirectoryAsync(string, bool, bool, CancellationToken)

Removes a directory from the MetaFileSystem. This method is not recursive in that it will only remove the last directory in the path. It also expects that the directory is empty.

Note that this method is subject to runtime checks that may not allow removing a directory in certain locations.

Declaration
Task RemoveDirectoryAsync(string path, bool recursive = false, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringpathThe directory path to remove.
System.BooleanrecursiveWhether or not to attempt to recursively remove the directory and its all of its subcontents. Defaults to false.
System.BooleanerrorWhenDoesNotExistWhether or not to throw an error when the directory in the path does not exist. Defaults to true.
System.Threading.CancellationTokencancellationToken

FileExistsAsync(string, CancellationToken)

Checks if a file exists in the Meta FileSystem at the provided path.

Declaration
Task<bool> FileExistsAsync(string path, CancellationToken cancellationToken = default)
Returns

Task<System.Boolean>

bool: true means the file does exist.

Parameters
TypeNameDescription
System.StringpathThe file path. Ex: folderA/folderB/filename.txt
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetFileMetadataAsync(string, bool, CancellationToken)

Retrieves the metadata of a file (not the raw content of the file) from the Meta FileSystem.

Declaration
Task<IFileMetadata?> GetFileMetadataAsync(string path, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns

Task< Workspace.XBR.Xperiflow.MetaFileSystem.IFileMetadata >

FileMetadata

Parameters
TypeNameDescription
System.StringpathThe file path. ex: folderA/folderB/filename.txt
System.BooleanerrorWhenDoesNotExistWhether or not to throw an error when the file does not exist. Defaults to true.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetFileContentStreamAsync(string, int?, CancellationToken)

Delegates the retrieval of file contents to a Stream object.

Declaration
Task<Stream> GetFileContentStreamAsync(string path, int? contentSize = -1, CancellationToken cancellationToken = default)
Returns

Task<System.IO.Stream>

Stream

Parameters
TypeNameDescription
System.StringpathThe file path. ex: folderA/folderB/filename.txt
System.Nullable<System.Int32>contentSizeThe amount of content in bytes to pull back from the stream. Default to -1 which means that all the content will be retrieved.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetFileContentStringAsync(string, int?, CancellationToken)

Retrieve the file contents to a string object.

Declaration
Task<string> GetFileContentStringAsync(string path, int? contentSize = -1, CancellationToken cancellationToken = default)
Returns

Task<System.String>

string

Parameters
TypeNameDescription
System.StringpathThe file path. ex: folderA/folderB/filename.txt
System.Nullable<System.Int32>contentSizeThe amount of content in bytes to pull back from the stream. Default to -1 which means that all the content will be retrieved.
System.Threading.CancellationTokencancellationToken

GetFileContentByteArrayAsync(string, int?, CancellationToken)

Retrieve the file contents to a byte array.

Declaration
Task<byte[]> GetFileContentByteArrayAsync(string path, int? contentSize = -1, CancellationToken cancellationToken = default)
Returns

Task<System.Byte[]>

byte[]

Parameters
TypeNameDescription
System.StringpathThe file path. ex: folderA/folderB/filename.txt
System.Nullable<System.Int32>contentSizeThe amount of content in bytes to pull back from the stream. Default to -1 which means that all the content will be retrieved.
System.Threading.CancellationTokencancellationToken

WriteFileAsync(string, Stream, bool, CancellationToken)

Writes a file to the Meta FileSystem using a stream object.

Note that this method is subject to runtime checks that may not allow writing a file in certain locations.

Declaration
Task WriteFileAsync(string path, Stream payload, bool overwriteOk = false, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringpathThe file path to write to. Note that if the file path does not have directories that exist, an error will be thrown.
System.IO.StreampayloadThe file payload to write.
System.BooleanoverwriteOkControls whether or not to overwrite the file if it already exists. Defaults to false. If false, an error will be thrown if the file already exists.
System.Threading.CancellationTokencancellationToken

WriteFileAsync(string, byte[], bool, CancellationToken)

Writes a file to the Meta FileSystem using a byte array.

Declaration
Task WriteFileAsync(string path, byte[] payload, bool overwriteOk = false, CancellationToken cancellationToken = default)
Remarks

Note that this method is subject to runtime checks that may not allow writing a file in certain locations.

Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringpathThe file path to write to. Note that if the file path does not have directories that exist, an error will be thrown.
System.Byte[]payloadThe file payload to write.
System.BooleanoverwriteOkControls whether or not to overwrite the file if it already exists. Defaults to false. If false, an error will be thrown if the file already exists.
System.Threading.CancellationTokencancellationToken

WriteFileAsync(string, string, bool, CancellationToken)

Writes a file to the Meta FileSystem using a string payload.

Note that this method is subject to runtime checks that may not allow writing a file in certain locations.

Declaration
Task WriteFileAsync(string path, string payload, bool overwriteOk = false, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringpathThe file path to write to. Note that if the file path does not have directories that exist, an error will be thrown.
System.StringpayloadThe file payload to write.
System.BooleanoverwriteOkControls whether or not to overwrite the file if it already exists. Defaults to false. If false, an error will be thrown if the file already exists.
System.Threading.CancellationTokencancellationToken

RemoveFileAsync(string, bool, CancellationToken)

Removes a file from the MetaFileSystem.

Note that this method is subject to runtime checks that may not allow removing a file in certain locations.

Declaration
Task RemoveFileAsync(string path, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Stringpath
System.BooleanerrorWhenDoesNotExist
System.Threading.CancellationTokencancellationToken

Was this page helpful?