UNPKG

@chtsinc/ch-uploader

Version:

A pluggable, cloud-agnostic file uploader for Azure, S3, and more.

23 lines (22 loc) 681 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getContentType = getContentType; // src/utils/contentType.ts const extensionMap = { html: 'text/html', webm: 'video/webm', zip: 'application/zip', json: 'application/json', txt: 'text/plain', // …add more as needed }; /** * Returns a best‐guess Content-Type for a file extension. * @param extension The extension (with or without leading dot) */ function getContentType(extension) { const ext = extension.startsWith('.') ? extension.slice(1).toLowerCase() : extension.toLowerCase(); return extensionMap[ext] || 'application/octet-stream'; }