mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
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:
parent
fea999b3b5
commit
9c92200cf2
1 changed files with 0 additions and 18 deletions
|
|
@ -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]}`
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue