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

Function formatFileSize

frontend/src/hooks/stream/useStreamingCSVParser.ts:421–426  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

419
420 // Helper function to format file size
421 const formatFileSize = (bytes: number): string => {
422 if (bytes < 1024) return `${bytes} B`;
423 if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
424 if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
425 return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
426 };
427
428 return {
429 parseCSV,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected