Interface IMetaFileSystemClient
The MetaFileSystemClient is used to retrieve files and directories from Xperiflow
Namespace: Workspace.XBR.Xperiflow.MetaFileSystem
Assembly: Xperiflow.dll
public interface IMetaFileSystemClient
Methods
DirectoryExistsAsync(string, CancellationToken)
Checks if a directory exists in the Meta FileSystem at the provided path.
Task<bool> DirectoryExistsAsync(string path, CancellationToken cancellationToken = default)
Returns
Task<System.Boolean>
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to the directory. If the directory path. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
GetDirectoryMetadataAsync(string, bool, CancellationToken)
Retrieves only the metadata of a directory (no subdirectories or subfiles) from the Meta FileSystem.
Task<IDirectoryMetadata?> GetDirectoryMetadataAsync(string path, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns
Task
< Workspace.XBR.Xperiflow.MetaFileSystem.IDirectoryMetadata >
DirectoryMetadata
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to the folder. If the folder path does not exist, an error will be thrown. |
System.Boolean | errorWhenDoesNotExist | Whether or not to throw an error when the directory does not exist. Defaults to true. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
GetDirectoryAsync(string, int?, bool, bool, CancellationToken)
Retrieves a directory and its subcontents (other file and folders metdata) from the Meta FileSystem.
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
Type | Name | Description |
---|---|---|
System.String | path | The path to the folder. If the folder path does not exist, an error will be thrown. |
System.Nullable<System.Int32> | maxDepth | The max depth of subcontents to grab. Defaults to 1 level deep of subcontents. Set to -1 or null to grab all subcontents. |
System.Boolean | includeDirectories | Whether or not to include subfolders in the subcontents. Defaults to true. |
System.Boolean | errorWhenDoesNotExist | Whether or not to throw an error when the directory does not exist. Defaults to true. |
System.Threading.CancellationToken | cancellationToken | The 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.
Task MakeDirectoriesAsync(string path, bool existsOk = false, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The directory path to create. |
System.Boolean | existsOk | Controls whether or not to throw an error if the directory already exists. Defaults to false. |
System.Threading.CancellationToken | cancellationToken |
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.
Task RemoveDirectoryAsync(string path, bool recursive = false, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The directory path to remove. |
System.Boolean | recursive | Whether or not to attempt to recursively remove the directory and its all of its subcontents. Defaults to false. |
System.Boolean | errorWhenDoesNotExist | Whether or not to throw an error when the directory in the path does not exist. Defaults to true. |
System.Threading.CancellationToken | cancellationToken |
FileExistsAsync(string, CancellationToken)
Checks if a file exists in the Meta FileSystem at the provided path.
Task<bool> FileExistsAsync(string path, CancellationToken cancellationToken = default)
Returns
Task<System.Boolean>
bool: true means the file does exist.
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path. Ex: folderA/folderB/filename.txt |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
GetFileMetadataAsync(string, bool, CancellationToken)
Retrieves the metadata of a file (not the raw content of the file) from the Meta FileSystem.
Task<IFileMetadata?> GetFileMetadataAsync(string path, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns
Task
< Workspace.XBR.Xperiflow.MetaFileSystem.IFileMetadata >
FileMetadata
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path. ex: folderA/folderB/filename.txt |
System.Boolean | errorWhenDoesNotExist | Whether or not to throw an error when the file does not exist. Defaults to true. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
GetFileContentStreamAsync(string, int?, CancellationToken)
Delegates the retrieval of file contents to a Stream object.
Task<Stream> GetFileContentStreamAsync(string path, int? contentSize = -1, CancellationToken cancellationToken = default)
Returns
Task<System.IO.Stream>
Stream
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path. ex: folderA/folderB/filename.txt |
System.Nullable<System.Int32> | contentSize | The 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.CancellationToken | cancellationToken | The cancellation token. |
GetFileContentStringAsync(string, int?, CancellationToken)
Retrieve the file contents to a string object.
Task<string> GetFileContentStringAsync(string path, int? contentSize = -1, CancellationToken cancellationToken = default)
Returns
Task<System.String>
string
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path. ex: folderA/folderB/filename.txt |
System.Nullable<System.Int32> | contentSize | The 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.CancellationToken | cancellationToken |
GetFileContentByteArrayAsync(string, int?, CancellationToken)
Retrieve the file contents to a byte array.
Task<byte[]> GetFileContentByteArrayAsync(string path, int? contentSize = -1, CancellationToken cancellationToken = default)
Returns
Task<System.Byte[]>
byte[]
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path. ex: folderA/folderB/filename.txt |
System.Nullable<System.Int32> | contentSize | The 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.CancellationToken | cancellationToken |
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.
Task WriteFileAsync(string path, Stream payload, bool overwriteOk = false, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path to write to. Note that if the file path does not have directories that exist, an error will be thrown. |
System.IO.Stream | payload | The file payload to write. |
System.Boolean | overwriteOk | Controls 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.CancellationToken | cancellationToken |
WriteFileAsync(string, byte[], bool, CancellationToken)
Writes a file to the Meta FileSystem using a byte array.
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
Type | Name | Description |
---|---|---|
System.String | path | The file path to write to. Note that if the file path does not have directories that exist, an error will be thrown. |
System.Byte[] | payload | The file payload to write. |
System.Boolean | overwriteOk | Controls 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.CancellationToken | cancellationToken |
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.
Task WriteFileAsync(string path, string payload, bool overwriteOk = false, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path to write to. Note that if the file path does not have directories that exist, an error will be thrown. |
System.String | payload | The file payload to write. |
System.Boolean | overwriteOk | Controls 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.CancellationToken | cancellationToken |
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.
Task RemoveFileAsync(string path, bool errorWhenDoesNotExist = true, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.String | path |
System.Boolean | errorWhenDoesNotExist |
System.Threading.CancellationToken | cancellationToken |