mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-26 17:48:59 +03:00
show disk space reclaimed by media sync (#24189)
This commit is contained in:
committed by
Nicolas Mowen
parent
d6b93301e2
commit
6d33b31bc6
@@ -5,3 +5,11 @@ export const getUnitSize = (MB: number) => {
|
||||
|
||||
return `${(MB / 1048576).toFixed(2)} TiB`;
|
||||
};
|
||||
|
||||
export const getUnitSizeFromBytes = (bytes: number) => {
|
||||
if (bytes === null || isNaN(bytes) || bytes < 0) return "Invalid number";
|
||||
if (bytes < 1024) return `${bytes} B`;
|
||||
if (bytes < 1048576) return `${(bytes / 1024).toFixed(2)} KiB`;
|
||||
|
||||
return getUnitSize(bytes / 1048576);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user