MCPcopy Create free account
hub / github.com/winfunc/opcode / formatFileSize

Function formatFileSize

src/components/FilePicker.tsx:79–85  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

77
78// Format file size to human readable
79const formatFileSize = (bytes: number): string => {
80 if (bytes === 0) return '';
81 const k = 1024;
82 const sizes = ['B', 'KB', 'MB', 'GB'];
83 const i = Math.floor(Math.log(bytes) / Math.log(k));
84 return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`;
85};
86
87/**
88 * FilePicker component - File browser with fuzzy search

Callers 1

FilePickerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected