26 lines
2.0 KiB
C#
26 lines
2.0 KiB
C#
using System.Text;
|
|
|
|
namespace OpenHarbor.Storage.Abstractions;
|
|
|
|
public interface IStorageProvider
|
|
{
|
|
Task<List<IDirectoryOrFile>> GetListAsync(string path, CancellationToken cancellationToken);
|
|
Task<List<IDirectoryInfo>> GetDirectoriesAsync(string path, CancellationToken cancellationToken);
|
|
Task<List<IFileInfo>> GetFilesAsync(string path, string? pattern = null, SearchOption searchOption = SearchOption.TopDirectoryOnly, CancellationToken cancellationToken = default);
|
|
Task<IFileInfo> WriteFileAsync(string sourcePath, string path, bool overrideIfExists = true, CancellationToken cancellationToken = default);
|
|
Task<IFileInfo> WriteFileAsync(byte[] bytes, string path, bool overrideIfExists = true, CancellationToken cancellationToken = default);
|
|
Task<IFileInfo> WriteFileAsync(Stream stream, string path, bool overrideIfExists = true, CancellationToken cancellationToken = default);
|
|
Task<IFileInfo> WriteFileAsync(string sourcePath, string path, IWriteFileOptions options, CancellationToken cancellationToken);
|
|
Task<IFileInfo> WriteFileAsync(byte[] bytes, string path, IWriteFileOptions options, CancellationToken cancellationToken);
|
|
Task<IFileInfo> WriteFileAsync(Stream stream, string path, IWriteFileOptions options, CancellationToken cancellationToken);
|
|
Task<Stream> GetFileStreamAsync(string path, CancellationToken cancellationToken);
|
|
Task<byte[]> GetFileBytesAsync(string path, CancellationToken cancellationToken);
|
|
Task<string> GetFileContentAsync(string path, Encoding encoding, CancellationToken cancellationToken);
|
|
Task<bool> FileExistsAsync(string path, CancellationToken cancellationToken);
|
|
Task DeleteFileAsync(string path, CancellationToken cancellationToken);
|
|
Task DeleteDirectoryAsync(string path, bool force = false, CancellationToken cancellationToken = default);
|
|
Task<IDirectoryInfo> CreateDirectoryAsync(string path, CancellationToken cancellationToken);
|
|
|
|
bool IsFileNameAllowed(string fileName);
|
|
string SanitizeFileName(string key, string replacement);
|
|
} |