diff --git a/src/renderer/src/pages/library/library-game-card-large.tsx b/src/renderer/src/pages/library/library-game-card-large.tsx index dafd7f3c..2a0b7cea 100644 --- a/src/renderer/src/pages/library/library-game-card-large.tsx +++ b/src/renderer/src/pages/library/library-game-card-large.tsx @@ -1,6 +1,6 @@ import { LibraryGame } from "@types"; import { useGameCard } from "@renderer/hooks"; -import { formatBytes } from "@renderer/utils"; +import { formatBytes } from "@shared"; import { ClockIcon, AlertFillIcon, diff --git a/src/renderer/src/utils/format-bytes.ts b/src/renderer/src/utils/format-bytes.ts deleted file mode 100644 index 57ddf616..00000000 --- a/src/renderer/src/utils/format-bytes.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Converts a number of bytes into a human-readable string with appropriate units - * @param bytes - The number of bytes to format - * @param decimals - Number of decimal places (default: 2) - * @returns Formatted string like "1.5 GB", "256 MB", etc. - */ -export const formatBytes = (bytes: number, decimals = 2): string => { - if (bytes === 0) return "0 B"; - - const k = 1024; - const dm = decimals < 0 ? 0 : decimals; - const sizes = ["B", "KB", "MB", "GB", "TB", "PB"]; - - const i = Math.floor(Math.log(bytes) / Math.log(k)); - const index = Math.min(i, sizes.length - 1); - - return `${parseFloat((bytes / Math.pow(k, index)).toFixed(dm))} ${sizes[index]}`; -}; diff --git a/src/renderer/src/utils/index.ts b/src/renderer/src/utils/index.ts deleted file mode 100644 index 7a828a7f..00000000 --- a/src/renderer/src/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./format-bytes";