MCPcopy Create free account
hub / github.com/TanStack/ai / formatBytes

Function formatBytes

examples/ts-code-mode-web/src/lib/efficiency.ts:221–225  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

219// === Formatters ===
220
221export function formatBytes(bytes: number): string {
222 if (bytes < 1024) return `${bytes} B`
223 if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`
224 return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
225}
226
227export function formatDuration(ms: number): string {
228 if (ms < 1000) return `${ms}ms`

Callers 2

ContextSavingsFunction · 0.90
NoCodeMetricsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected