UNPKG

@vechain/vebetterdao-contracts

Version:

Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.

21 lines (20 loc) 792 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMimeType = getMimeType; const mime_types_1 = __importDefault(require("mime-types")); /** * Validates and returns the MIME type for a given filename * @param filename - The name of the file (e.g., 'image.png', 'data.json') * @returns The MIME type string * @throws Error if the file type is not supported */ function getMimeType(filename) { const mimeType = mime_types_1.default.lookup(filename); if (!mimeType) { throw new Error(`Unsupported file type: ${filename}. Please ensure the file has a valid extension.`); } return mimeType; }