So here we are with another day of coding under the belt and yet I still feel a sense of pride when something so simple presents itself.
public static class ULongExtensions
{
static string[] suffix = ["B", "KB", "MB", "GB", "TB", "PB", "ZB"];
public static string ToReadableBytes(this ulong that)
{
var index = 0;
while (that > 1024ul)
{
index++;
that /= 1024ul;
}
return $"{that} {suffix[index]}";
}
}