Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s
14 lines
595 B
TypeScript
14 lines
595 B
TypeScript
import * as fileType from 'file-type';
|
|
import { PicType } from '../types';
|
|
export async function getFileTypeForSendType(picPath: string): Promise<PicType> {
|
|
const fileTypeResult = (await fileType.fileTypeFromFile(picPath))?.ext ?? 'jpg';
|
|
const picTypeMap: { [key: string]: PicType } = {
|
|
//'webp': PicType.NEWPIC_WEBP,
|
|
'gif': PicType.NEWPIC_GIF,
|
|
// 'png': PicType.NEWPIC_APNG,
|
|
// 'jpg': PicType.NEWPIC_JPEG,
|
|
// 'jpeg': PicType.NEWPIC_JPEG,
|
|
// 'bmp': PicType.NEWPIC_BMP,
|
|
};
|
|
return picTypeMap[fileTypeResult] ?? PicType.NEWPIC_JPEG;
|
|
} |