MCPcopy Create free account
hub / github.com/MemeTray/MemeTray / formatFileSize

Function formatFileSize

tools/common/fileUploadHelpers.js:212–216  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

210 * @returns {string} Human-readable size string
211 */
212export function formatFileSize(bytes) {
213 if (bytes < 1024) return bytes + ' B';
214 if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
215 return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
216}
217
218/**
219 * Calculate the SHA-256 hash of a file

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected