mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-11 19:49:06 +00:00
17 lines
460 B
C#
17 lines
460 B
C#
namespace AIStudio.Tools;
|
|
|
|
public static class FileInfoExtensions
|
|
{
|
|
/// <summary>
|
|
/// Returns the file size in human-readable format.
|
|
/// </summary>
|
|
/// <param name="fileInfo">The file info object.</param>
|
|
/// <returns>The file size in human-readable format.</returns>
|
|
public static string FileSize(this FileInfo fileInfo)
|
|
{
|
|
if (!fileInfo.Exists)
|
|
return "N/A";
|
|
|
|
return fileInfo.Length.FileSize();
|
|
}
|
|
} |