web端打通oss资源上传
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import { randomUUID } from 'crypto';
|
||||
|
||||
export function buildOssObjectKey(uploadPrefix: string, bizType: string, fileName: string): string {
|
||||
const ext = fileName.includes('.') ? fileName.split('.').pop() : 'bin';
|
||||
const dir = `${uploadPrefix.replace(/\/$/, '')}/${bizType.toLowerCase()}/`;
|
||||
return `${dir}${Date.now()}-${randomUUID().slice(0, 8)}.${ext}`;
|
||||
}
|
||||
Reference in New Issue
Block a user