UNPKG

@mintlify/common

Version:

Commonly shared code within Mintlify

13 lines (12 loc) 566 B
import path from 'path'; import { removeBasePath } from '../fs/removeBasePath.js'; import { getS3URI } from '../services/aws.js'; export const getS3ImageUri = (imagePath, subdomain, filePath, basePath, opts = {}) => { if (imagePath.startsWith('/')) { const path = removeBasePath(imagePath, basePath); return getS3URI(subdomain, path, opts); } const beforeFilePath = path.join(filePath, '../'); const relativePath = removeBasePath(path.join(beforeFilePath, imagePath), basePath); return getS3URI(subdomain, relativePath, opts); };