Files
douyin/storage/IMediaStorage.cs

28 lines
1.2 KiB
C#

using dy.net.model.dto;
namespace dy.net.storage
{
public interface IMediaStorage
{
StorageType StorageType { get; }
Task EnsureDirectoryAsync(string path, CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(string path, CancellationToken cancellationToken = default);
Task<long?> GetLengthAsync(string path, CancellationToken cancellationToken = default);
Task WriteAsync(string path, Stream source, long? contentLength = null, string contentType = null, CancellationToken cancellationToken = default);
Task<StorageReadResult> OpenReadAsync(string path, long? from = null, long? to = null, CancellationToken cancellationToken = default);
Task DeleteAsync(string path, CancellationToken cancellationToken = default);
}
/// <summary>
/// Optional capability for providers that expose a canonical path spelling different from
/// the logical path requested by the application.
/// </summary>
public interface ICanonicalMediaStorage
{
Task<string> CanonicalizePathAsync(
string path,
bool createParentDirectories = false,
CancellationToken cancellationToken = default);
}
}