refactor: 优化调整文件处理

This commit is contained in:
手瓜一十雪
2024-12-04 11:38:59 +08:00
parent 86f734c1a6
commit f33786b152
11 changed files with 55 additions and 124 deletions

View File

@@ -1,7 +1,7 @@
import * as fileType from 'file-type';
import { fileTypeFromFile } from 'file-type';
import { PicType } from '../types';
export async function getFileTypeForSendType(picPath: string): Promise<PicType> {
const fileTypeResult = (await fileType.fileTypeFromFile(picPath))?.ext ?? 'jpg';
const fileTypeResult = (await fileTypeFromFile(picPath))?.ext ?? 'jpg';
const picTypeMap: { [key: string]: PicType } = {
//'webp': PicType.NEWPIC_WEBP,
'gif': PicType.NEWPIC_GIF,