mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-18 00:16:41 +01:00
8 lines
269 B
TypeScript
8 lines
269 B
TypeScript
export const getUnitSize = (MB: number) => {
|
|
if (MB === null || isNaN(MB) || MB < 0) return "Invalid number";
|
|
if (MB < 1024) return `${MB.toFixed(2)} MiB`;
|
|
if (MB < 1048576) return `${(MB / 1024).toFixed(2)} GiB`;
|
|
|
|
return `${(MB / 1048576).toFixed(2)} TiB`;
|
|
};
|