UNPKG

cloud-presign

Version:

A unified presigned URL generator for multiple cloud platforms

10 lines (9 loc) 346 B
import path from "path"; export class Common { async generateFileUniqueName(fileName: string): Promise<string> { const fileExtension = path.extname(fileName); const randomNumber = Math.floor(Math.random() * 1000000); const date = new Date(); return `${date.getTime()}-${randomNumber}${fileExtension}`; } }