Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
export const formatFileSize = (size?: number) => {
if (typeof size === "number") {
export const formatFileSize = (size?: number) => {
if (typeof size === "number") {
+ if (size === 0) { return "0 B"; }
+
for (const { base, unit } of FILE_SIZES) {
if (size >= base) {
return `${(size / base).toFixed()} ${unit}`;
for (const { base, unit } of FILE_SIZES) {
if (size >= base) {
return `${(size / base).toFixed()} ${unit}`;