api duplicate รูปภาพโปรไฟล์
This commit is contained in:
parent
56241eda4f
commit
30ac106894
2 changed files with 60 additions and 0 deletions
|
|
@ -145,4 +145,18 @@ export async function s3DownloadFile(...pathname: string[]) {
|
|||
};
|
||||
}
|
||||
|
||||
export async function duplicateAvatarFile(refId: string, prefix: string, fileName: string) {
|
||||
try {
|
||||
await minio.statObject(MINIO_BUCKET, refId);
|
||||
const avatar = `${prefix}/${fileName}`;
|
||||
await minio.copyObject(
|
||||
MINIO_BUCKET,
|
||||
avatar,
|
||||
`/${MINIO_BUCKET}/${refId}`
|
||||
);
|
||||
} catch (error) {
|
||||
exception(error);
|
||||
}
|
||||
}
|
||||
|
||||
export const fileLocation = (...path: string[]) => path.join("/");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue