const config_path = require("../../configs/path.json"); const dbField = require("../map/dbField"); const {toNumber} = require("./typeTool_cjs"); function filePathToUrl(fileType, fileName){ let basePath = config_path.baseFiles; fileType = toNumber(fileType); if(fileType === dbField.db_base.fileType.image){ basePath = config_path.baseImages; }else if(fileType === dbField.db_base.fileType.video){ basePath = config_path.baseVideos; }else{ basePath = config_path.baseFiles; } return `${basePath}/${fileName}`; } module.exports = { filePathToUrl }