MCPcopy
hub / github.com/RedPlanetHQ/core / formatBytes

Function formatBytes

packages/cli/src/server/tools/exec-tools.ts:25–29  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

23const KILL_MULTIPLIER = 8;
24
25function formatBytes(n: number): string {
26 if (n < 1024) return `${n} B`;
27 if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
28 return `${(n / (1024 * 1024)).toFixed(1)} MB`;
29}
30
31/**
32 * Capture child-process stream output without retaining more than `maxBytes`.

Callers 3

finalizeMethod · 0.70
finishFunction · 0.70
buildTruncationNoteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected