MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / formatFileSize

Function formatFileSize

frontend/src/components/workspace/FolderTreeView.tsx:191–197  ·  view source on GitHub ↗
(bytes?: number)

Source from the content-addressed store, hash-verified

189
190 // Format file size
191 const formatFileSize = (bytes?: number) => {
192 if (!bytes) return '';
193 const sizes = ['B', 'KB', 'MB', 'GB'];
194 const i = Math.floor(Math.log(bytes) / Math.log(1024));
195 const size = (bytes / Math.pow(1024, i)).toFixed(1)
196 return size !== '0' ? `${size} ${sizes[i]}` : '';
197 };
198
199 // Handle drag start
200 const handleDragStart = (e: React.DragEvent, node: FolderNode) => {

Callers 1

renderNodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected