style: lint

This commit is contained in:
手瓜一十雪
2024-08-26 01:00:07 +08:00
parent 4c295d43dc
commit 901c680b1f
7 changed files with 14 additions and 130 deletions

View File

@@ -4,7 +4,7 @@ import crypto, { randomUUID } from 'crypto';
import util from 'util';
import path from 'node:path';
import * as fileType from 'file-type';
import { solveAsyncProblem, solveProblem } from './helper';
import { solveProblem } from './helper';
export function isGIF(path: string) {
const buffer = Buffer.alloc(4);
@@ -194,7 +194,7 @@ export async function checkUriType(Uri: string) {
return undefined;
}, Uri);
if (LocalFileRet) return LocalFileRet;
const OtherFileRet = await solveProblem((uri: string) => {
//再判断是否是Http
if (uri.startsWith('http://') || uri.startsWith('https://')) {
@@ -217,7 +217,7 @@ export async function checkUriType(Uri: string) {
}
}, Uri);
if (OtherFileRet) return OtherFileRet;
return { Uri: Uri, Type: FileUriType.Unknown };
}

View File

@@ -24,11 +24,11 @@ export async function getVideoInfo(filePath: string, logger: LogWrapper) {
if (videoStream) {
logger.log(`视频尺寸: ${videoStream.width}x${videoStream.height}`);
} else {
return reject('未找到视频流信息。');
return reject(new Error('未找到视频流信息。'));
}
resolve({
width: videoStream.width!, height: videoStream.height!,
time: parseInt(videoStream.duration!),
time: +(videoStream.duration ?? 10),
format: metadata.format.format_name!,
size,
filePath,
@@ -38,7 +38,7 @@ export async function getVideoInfo(filePath: string, logger: LogWrapper) {
});
}
export function checkFfmpeg(newPath: string | null = null, logger: LogWrapper): Promise<boolean> {
export function checkFfmpeg(logger: LogWrapper,newPath: string | null = null): Promise<boolean> {
return new Promise((resolve, reject) => {
logger.log('开始检查ffmpeg', newPath);
if (newPath) {