Static
formatConverts a byte count to a human-readable string using appropriate size units.
Automatically selects the most appropriate unit (B, KB, MB, GB, TB) based on the size and formats the result with the specified number of decimal places.
The number of bytes to format.
Optional
decimals: number = 2Number of decimal places to include in the result.
A formatted string with the appropriate unit.
import { AcTrStringUtil } from './AcCmStringUtil'
// Format different byte sizes
AcTrStringUtil.formatBytes(0) // "0 B"
AcTrStringUtil.formatBytes(1024) // "1 KB"
AcTrStringUtil.formatBytes(1024 * 1024) // "1 MB"
AcTrStringUtil.formatBytes(1536, 1) // "1.5 KB"
AcTrStringUtil.formatBytes(2048000, 0) // "2 MB"
Utility class providing static methods for string operations and formatting.
Contains helper functions for data formatting, size conversions, and other string manipulation tasks commonly needed in AutoCAD file processing.
AcTrStringUtil
Version
1.0.0