MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / formatBytes

Function formatBytes

ui/src/lib/file-model.ts:174–179  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

172
173/** `24.2 KB` — sizes on this screen are for scale, never for accounting. */
174export function formatBytes(bytes: number): string {
175 if (!Number.isFinite(bytes) || bytes < 0) return '—';
176 if (bytes < 1024) return `${bytes} B`;
177 if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
178 return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
179}
180
181/**
182 * The line under the file name: `typescript · 24.2 KB · 23 symbols · generated`.

Callers 2

fileMetaLineFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected