chore: remove unused formatBytes.ts file

The file was left over after size calculation was removed from
task-storage-size.ts for performance reasons. Knip correctly detected
it as unused.
This commit is contained in:
Hannes Rudolph 2026-01-26 18:55:56 -07:00
parent fea999b3b5
commit 9c92200cf2

View file

@ -1,18 +0,0 @@
/**
* Formats bytes into a human-readable string with appropriate units.
*
* Note: This is intentionally simple (base-2 / 1024) and consistent with existing
* formatting expectations in tests and UI.
*/
export function formatBytes(bytes: number): string {
if (bytes === 0) return "0 B"
const units = ["B", "KB", "MB", "GB", "TB"]
const k = 1024
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), units.length - 1)
const size = bytes / Math.pow(k, i)
// Use 2 decimal places for MB and above, 0 for B and KB
const decimals = i >= 2 ? 2 : 0
return `${size.toFixed(decimals)} ${units[i]}`
}