/** * Formatting Utilities * * Provides utilities for formatting values in human-readable formats. */ /** * Options for formatting bytes */ export interface FormatBytesOptions { /** Number of decimal places (default: 2) */ decimals?: number; /** Threshold for switching units - use 1024 for binary, 1000 for decimal (default: 1024) */ threshold?: number; /** Whether to include a space between number and unit (default: true) */ space?: boolean; } /** * Format a byte count into a human-readable string * * @param bytes - The number of bytes to format * @param options - Formatting options * @returns Formatted string (e.g., "1.24 MB", "512 KB") * * @example * formatBytes(0) // "0 B" * formatBytes(500) // "500 B" * formatBytes(1024) // "1.00 KB" * formatBytes(1536) // "1.50 KB" * formatBytes(1048576) // "1.00 MB" * formatBytes(1073741824) // "1.00 GB" * formatBytes(1536, { decimals: 1 }) // "1.5 KB" */ export declare function formatBytes(bytes: number, options?: FormatBytesOptions): string; /** * Format bytes with automatic precision adjustment * Uses fewer decimal places for larger numbers * * @param bytes - The number of bytes to format * @returns Formatted string with smart precision * * @example * formatBytesAuto(1536) // "1.50 KB" * formatBytesAuto(15360) // "15.0 KB" * formatBytesAuto(153600) // "150 KB" */ export declare function formatBytesAuto(bytes: number): string; /** * Format a download progress as a string * * @param downloaded - Bytes downloaded * @param total - Total bytes (0 if unknown) * @returns Formatted progress string * * @example * formatDownloadProgress(1048576, 10485760) // "1.00 MB / 10.00 MB" * formatDownloadProgress(1048576, 0) // "1.00 MB" */ export declare function formatDownloadProgress(downloaded: number, total: number): string; /** * Format a percentage value * * @param value - The percentage (0-100) * @param decimals - Number of decimal places (default: 0) * @returns Formatted percentage string * * @example * formatPercent(50) // "50%" * formatPercent(33.333) // "33%" * formatPercent(33.333, 1) // "33.3%" */ export declare function formatPercent(value: number, decimals?: number): string; //# sourceMappingURL=format.d.ts.map