remove pino

This commit is contained in:
2025-05-08 23:43:56 +08:00
parent aa4d2b5451
commit c3b24ec29c
9 changed files with 1945 additions and 200 deletions

View File

@@ -1,7 +1,7 @@
import dayjs from 'dayjs';
import { minioClient } from '../../../modules/minio.ts';
import { bucketName } from '../../../modules/minio.ts';
import { CopyDestinationOptions, CopySourceOptions } from 'minio';
import { BucketItemStat, CopyDestinationOptions, CopySourceOptions } from 'minio';
type MinioListOpt = {
prefix: string;
recursive?: boolean;
@@ -43,7 +43,7 @@ export const getMinioList = async <IS_FILE extends boolean>(opts: MinioListOpt):
});
return res as IS_FILE extends true ? MinioFile[] : MinioDirectory[];
};
export const getFileStat = async (prefix: string, isFile?: boolean): Promise<any> => {
export const getFileStat = async (prefix: string, isFile?: boolean): Promise<BucketItemStat | null> => {
try {
const obj = await minioClient.statObject(bucketName, prefix);
if (isFile && obj.size === 0) {
@@ -174,7 +174,8 @@ export const mvUserAToUserB = async (usernameA: string, usernameB: string, clear
const source = new CopySourceOptions({ Bucket: bucketName, Object: item.name });
const stat = await getFileStat(item.name);
const newName = item.name.slice(oldPrefix.length);
const metadata = stat?.userMetadata;
// @ts-ignore
const metadata = stat?.userMetadata || stat.metaData;
const destination = new CopyDestinationOptions({
Bucket: bucketName,
Object: `${newPrefix}${newName}`,