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

Function formatPercent

src/upload-progress.ts:98–101  ·  view source on GitHub ↗
(transferredBytes: number, totalBytes: number)

Source from the content-addressed store, hash-verified

96}
97
98function formatPercent(transferredBytes: number, totalBytes: number): string {
99 if (totalBytes <= 0) return '100%';
100 return `${Math.min(100, Math.floor((transferredBytes / totalBytes) * 100))}%`;
101}
102
103function formatBytes(bytes: number): string {
104 if (bytes < 1024) return `${bytes} B`;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected