feat!: 将项目有Strapi迁移至Directus #43

Manually merged
remilia merged 30 commits from feat/directus into master 2025-10-24 17:22:40 +08:00
24 changed files with 1485 additions and 98 deletions
Showing only changes of commit cb861bc955 - Show all commits

View File

@ -1,12 +1,19 @@
export function formatFileSize(sizeInKB: number): string {
if (sizeInKB < 1024) {
export function formatFileSize(sizeInBytes: number): string {
if (sizeInBytes < 1024) {
return `${sizeInBytes.toFixed(2)} B`;
} else if (sizeInBytes < 1024 * 1024) {
const sizeInKB = sizeInBytes / 1024;
return `${sizeInKB.toFixed(2)} KB`;
} else {
const sizeInMB = sizeInKB / 1024;
const sizeInMB = sizeInBytes / 1024 / 1024;
return `${sizeInMB.toFixed(2)} MB`;
}
}
export function getFileExtension(filename: string): string {
return filename.split('.').pop() || '';
}
export function formatFileExtension(ext: string): string {
return ext.startsWith('.') ? ext.slice(1).toUpperCase() : ext.toUpperCase();
}