Files
jinshen-website/app/utils/file.ts
R2m1liA f957adfa5d feat: 完成网站前端的基本建设
- 网站内容展示:首页, 产品页, 解决方案, 联系信息等
- 网站跳转逻辑:通过Vue-Router实现路由跳转
- 后端通信: 通过Nuxt Strapi与后端Strapi服务进行通信
2025-09-06 15:59:52 +08:00

12 lines
379 B
TypeScript

export function formatFileSize(sizeInKB: number): string {
if (sizeInKB < 1024) {
return `${sizeInKB.toFixed(2)} KB`;
} else {
const sizeInMB = sizeInKB / 1024;
return `${sizeInMB.toFixed(2)} MB`;
}
}
export function formatFileExtension(ext: string): string {
return ext.startsWith('.') ? ext.slice(1).toUpperCase() : ext.toUpperCase();
}