MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / formatSize

Function formatSize

src/runtime/adapters/attachment-utils.ts:122–127  ·  view source on GitHub ↗

* Format a human-readable file size.

(bytes?: number)

Source from the content-addressed store, hash-verified

120 * Format a human-readable file size.
121 */
122function formatSize(bytes?: number): string {
123 if (bytes === undefined || bytes === null) return "";
124 if (bytes < 1024) return `${bytes}B`;
125 if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
126 return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
127}
128
129/**
130 * Format non-image attachments as a text block to inject into the agent prompt.

Callers 1

formatAttachmentsPromptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected