Files
dbgate/packages/web/src/utility/formatFileSize.ts
Jan Prochazka 913f89e970 shell tab
2021-03-11 13:40:19 +01:00

7 lines
288 B
TypeScript

export default function formatFileSize(size) {
if (size > 1000000000) return `${Math.round(size / 10000000000) * 10} GB`;
if (size > 1000000) return `${Math.round(size / 10000000) * 10} MB`;
if (size > 1000) return `${Math.round(size / 10000) * 10} KB`;
return `${size} bytes`;
}