UNPKG

cloud-presign

Version:

A unified presigned URL generator for multiple cloud platforms

17 lines (16 loc) 614 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Common = void 0; const path_1 = __importDefault(require("path")); class Common { async generateFileUniqueName(fileName) { const fileExtension = path_1.default.extname(fileName); const randomNumber = Math.floor(Math.random() * 1000000); const date = new Date(); return `${date.getTime()}-${randomNumber}${fileExtension}`; } } exports.Common = Common;