MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / fmtBytes

Function fmtBytes

dashboard/lcm/src/StoreHealth.tsx:54–65  ·  view source on GitHub ↗
(value: number | string | null | undefined)

Source from the content-addressed store, hash-verified

52}
53
54function fmtBytes(value: number | string | null | undefined): string {
55 const bytes = Number(value) || 0;
56 if (bytes < 1024) return `${bytes} B`;
57 const units = ["KiB", "MiB", "GiB", "TiB"];
58 let scaled = bytes / 1024;
59 let unit = 0;
60 while (scaled >= 1024 && unit < units.length - 1) {
61 scaled /= 1024;
62 unit += 1;
63 }
64 return `${scaled >= 10 ? Math.round(scaled) : scaled.toFixed(1)} ${units[unit]}`;
65}
66
67function healthPillClass(status: string): string {
68 if (status === "ok") return "hermes-lcm-pill hermes-lcm-pill-accent";

Callers 2

gcPhaseSummaryFunction · 0.85
StoreHealthCardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected