UNPKG

@mintlify/common

Version:

Commonly shared code within Mintlify

12 lines (11 loc) 540 B
import path from 'path'; export const getS3BaseUrl = (opts = {}) => { return `https://${opts.bucketName ? opts.bucketName : 'mintlify'}.s3.${opts.region ? opts.region : 'us-west-1'}.amazonaws.com`; }; export const getS3URI = (subdomain, resourcePath, opts = {}) => { if (resourcePath.startsWith('http://') || resourcePath.startsWith('https://')) return resourcePath; const subpath = path.join(subdomain, resourcePath); const baseUrl = new URL(getS3BaseUrl(opts)); return new URL(subpath, baseUrl).toString(); };