MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / formatSize

Function formatSize

frontend/packages/common/src/utils/postcat.tsx:66–73  ·  view source on GitHub ↗
(size: number, unit: string)

Source from the content-addressed store, hash-verified

64
65 // Helper function to format the byte length into a string
66 const formatSize = (size: number, unit: string) => {
67 const formattedSize = size.toFixed(2)
68 // Remove unnecessary '.00'
69 if (formattedSize.endsWith('.00')) {
70 return `${parseInt(formattedSize, 10)} ${unit}`
71 }
72 return `${formattedSize} ${unit}`
73 }
74
75 // Convert and format byte length to appropriate unit
76 if (inputByteLength < 0.1 * KB) {

Callers 1

byteToStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected