MCPcopy Create free account
hub / github.com/anus-dev/ANUS / formatMemoryUsage

Function formatMemoryUsage

packages/cli/src/ui/utils/formatters.ts:8–17  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

6 */
7
8export const formatMemoryUsage = (bytes: number): string => {
9 const gb = bytes / (1024 * 1024 * 1024);
10 if (bytes < 1024 * 1024) {
11 return `${(bytes / 1024).toFixed(1)} KB`;
12 }
13 if (bytes < 1024 * 1024 * 1024) {
14 return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
15 }
16 return `${gb.toFixed(2)} GB`;
17};
18
19/**
20 * Formats a duration in milliseconds into a concise, human-readable string (e.g., "1h 5s").

Callers 4

formatters.test.tsFile · 0.70
updateMemoryFunction · 0.50
bugCommand.tsFile · 0.50
useShellCommandProcessorFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected