using System.IO; namespace zero.FileStorage; public interface IFileSystem { /// /// Map a relative path to an absolute internal path /// string Map(string path); /// /// Map an internal path to a public accessible path /// string MapToPublicPath(string path); /// /// Determines whether a file or directory at the given path already exists /// Task Exists(string path, CancellationToken cancellationToken = default); /// /// Get information of a file /// Task GetFileInfo(string path, CancellationToken cancellationToken = default); /// /// Returns a readable stream for a file /// Task StreamFile(string path, CancellationToken cancellationToken = default); /// /// Creates a file at the given path /// Task CreateFile(string path, Stream fileStream, bool overwrite = false, CancellationToken cancellationToken = default); /// /// Deletes a file at the given path. This method returns if the file does not exist. /// Task DeleteFile(string path, CancellationToken cancellationToken = default); /// /// Moves a file to another path (can also be used to rename resources) /// Task MoveFile(string oldPath, string newPath, CancellationToken cancellationToken = default); /// /// Copies a file to another path /// Task CopyFile(string oldPath, string newPath, CancellationToken cancellationToken = default); /// /// Get information of a directory /// Task GetDirectoryInfo(string path, CancellationToken cancellationToken = default); /// /// Get all items within a directory /// IAsyncEnumerable GetDirectoryContent(string path = null, bool recursive = false, CancellationToken cancellationToken = default); /// /// Tries to create a directory at the given path. This method returns if the directory already exists. /// Task CreateDirectory(string path, CancellationToken cancellationToken = default); /// /// Deletes a directory at the given path. This method returns if the directory does not exist. /// Task DeleteDirectory(string path, bool recursive = false, CancellationToken cancellationToken = default); }