Files
mixtape/Finch/FileStorage/PhysicalFileMeta.cs
T

43 lines
988 B
C#
Raw Normal View History

2022-12-07 14:05:11 +01:00
using Microsoft.Extensions.FileProviders;
2026-04-07 14:23:29 +02:00
namespace Finch.FileStorage;
2022-12-07 14:05:11 +01:00
public class PhysicalFileMeta : IFileMeta
{
/// <inheritdoc />
public string Name { get; }
/// <inheritdoc />
public string Path { get; }
/// <inheritdoc />
public string AbsolutePath { get; }
/// <inheritdoc />
public string DirectoryPath { get; }
/// <inheritdoc />
public long Length { get; }
/// <inheritdoc />
public DateTimeOffset LastModifiedDate { get; }
/// <inheritdoc />
public bool IsDirectory { get; }
/// <inheritdoc />
public Dictionary<string, object> Properties { get; }
public PhysicalFileMeta(IFileInfo fileInfo, string path)
{
Path = path;
AbsolutePath = fileInfo.PhysicalPath;
Name = fileInfo.Name;
DirectoryPath = path.Substring(0, path.Length - fileInfo.Name.Length).TrimEnd('/');
LastModifiedDate = fileInfo.LastModified;
Length = fileInfo.Length;
IsDirectory = fileInfo.IsDirectory;
Properties = new();
}
}