feat: 上传文件到minio

This commit is contained in:
2024-10-07 01:54:13 +08:00
parent 477ad00d86
commit 8beb65e637
11 changed files with 195 additions and 104 deletions

View File

@@ -0,0 +1,18 @@
import path from 'path';
// 获取文件的 content-type
export const getContentType = (filePath: string) => {
const extname = path.extname(filePath);
const contentType = {
'.html': 'text/html',
'.js': 'text/javascript',
'.css': 'text/css',
'.json': 'application/json',
'.png': 'image/png',
'.jpg': 'image/jpg',
'.gif': 'image/gif',
'.svg': 'image/svg+xml',
'.wav': 'audio/wav',
'.mp4': 'video/mp4',
};
return contentType[extname] || 'application/octet-stream';
};