MCPcopy Create free account
hub / github.com/modelcontextprotocol/mcpb / formatFileSize

Function formatFileSize

src/cli/pack.ts:27–35  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

25}
26
27function formatFileSize(bytes: number): string {
28 if (bytes < 1024) {
29 return `${bytes}B`;
30 } else if (bytes < 1024 * 1024) {
31 return `${(bytes / 1024).toFixed(1)}kB`;
32 } else {
33 return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
34 }
35}
36
37function sanitizeNameForFilename(name: string): string {
38 // Replace spaces with hyphens

Callers 1

packExtensionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…