MCPcopy Index your code
hub / github.com/callstack/agent-device / formatBytes

Function formatBytes

src/upload-progress.ts:103–110  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

101}
102
103function formatBytes(bytes: number): string {
104 if (bytes < 1024) return `${bytes} B`;
105 const kib = bytes / 1024;
106 if (kib < 1024) return `${kib.toFixed(1)} KiB`;
107 const mib = kib / 1024;
108 if (mib < 1024) return `${mib.toFixed(1)} MiB`;
109 return `${(mib / 1024).toFixed(1)} GiB`;
110}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected