Merge pull request #41 from hydralauncher/fix/game-download-information

fix: game download information
This commit is contained in:
Hydra 2024-04-19 16:25:53 -03:00 committed by GitHub
commit 14e30d64fa

View file

@ -1,8 +1,8 @@
const FORMAT = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
export const formatBytes = (bytes: number): string => {
if (!Number.isFinite(bytes) || isNaN(bytes) || bytes < 0) {
return `N/A ${FORMAT[0]}`;
if (!Number.isFinite(bytes) || isNaN(bytes) || bytes <= 0) {
return `0 ${FORMAT[0]}`;
}
const byteKBase = 1024;