remove-bg / lib /utils.ts
gandli's picture
feat: 添加图像处理功能
2f7ab94
raw
history blame contribute delete
537 Bytes
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function getSizeTrans(fs: number): string {
if (fs < 1024) {
return String(fs);
} else if (fs < 1024 * 1024) {
return parseInt(String((fs * 10) / 1024)) / 10 + " KB";
} else if (fs < 1024 * 1024 * 1024) {
return parseInt(String((fs * 10) / 1024 / 1024)) / 10 + " MB";
} else {
return parseInt(String((fs * 10) / 1024 / 1024 / 1024)) / 10 + " GB";
}
}