2025-08-21 09:41:46 +09:00
|
|
|
import { clsx, type ClassValue } from "clsx";
|
|
|
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
|
|
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
|
|
|
return twMerge(clsx(inputs));
|
|
|
|
|
}
|
2025-09-26 13:11:34 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 파일 크기를 사람이 읽기 쉬운 형태로 포맷팅
|
|
|
|
|
*/
|
|
|
|
|
export function formatFileSize(bytes: number): string {
|
|
|
|
|
if (bytes === 0) return '0 Bytes';
|
|
|
|
|
const k = 1024;
|
|
|
|
|
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
|
|
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
|
|
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
|
|
|
}
|