MCPcopy Create free account
hub / github.com/Fibi66/FeiControl / formatFileSize

Function formatFileSize

src/components/FileBrowser.tsx:69–74  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

67}
68
69function formatFileSize(bytes: number): string {
70 if (bytes === 0) return "—";
71 const units = ["B", "KB", "MB", "GB"];
72 const i = Math.floor(Math.log(bytes) / Math.log(1024));
73 return `${(bytes / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0)} ${units[i]}`;
74}
75
76function getMonacoLanguage(name: string): string {
77 const ext = name.split(".").pop()?.toLowerCase() || "";

Callers 1

FileBrowserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected