in src/utils.js [2:19]
export function formatBytes(size) {
if (!size) {
return "-";
}
const KB = 1024;
if (size < KB) {
return size + " B";
}
const MB = 1000000;
if (size < MB) {
return (size / KB).toFixed(0) + " KB";
}
const GB = 1000000000;
if (size < GB) {
return (size / MB).toFixed(2) + " MB";
}
return (size / GB).toFixed(2) + " GB";
}