"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileMeta = void 0;
const MimeTypeRegistry_1 = require("../../../../services/MimeTypeRegistry");
const getExtensionFromName = (filename) => {
    const lastDotIndex = filename.lastIndexOf('.');
    if (lastDotIndex < 0) {
        return '';
    }
    return filename.slice(lastDotIndex + 1).toLowerCase();
};
const getFileMeta = (file) => {
    const extension = getExtensionFromName(file.name);
    if (file.type) {
        return {
            mimeType: file.type,
            extension,
        };
    }
    return {
        mimeType: MimeTypeRegistry_1.MimeTypeRegistry.getInstance().getMimeTypeByExtension(extension) || '',
        extension,
    };
};
exports.getFileMeta = getFileMeta;
