"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
class Media {
    constructor() {
        this.map = new Map();
    }
    getMedia(key) {
        const data = this.map.get(key);
        if (data === undefined) {
            throw new Error(`Cannot find image with the key ${key}`);
        }
        return data;
    }
    addMedia(key, filePath) {
        this.map.set(key, {
            referenceId: this.map.values.length,
            stream: fs.createReadStream(filePath),
            path: filePath,
            fileName: path.basename(filePath),
        });
    }
    get array() {
        const array = new Array();
        this.map.forEach((data) => {
            array.push(data);
        });
        return array;
    }
}
exports.Media = Media;
//# sourceMappingURL=index.js.map