diff --git a/src/Bundle.ts b/src/Bundle.ts index 5337965..ee3bc2d 100644 --- a/src/Bundle.ts +++ b/src/Bundle.ts @@ -4,6 +4,7 @@ import * as zip from "do-not-zip"; export const filesSymbol = Symbol("bundleFiles"); export const freezeSymbol = Symbol("bundleFreeze"); +export const mimeTypeSymbol = Symbol("bundleMimeType"); namespace Mime { export type type = string; @@ -18,11 +19,14 @@ namespace Mime { export default class Bundle { private [filesSymbol]: { [key: string]: Buffer } = {}; + private [mimeTypeSymbol]: string; - constructor(public mimeType: `${Mime.type}/${Mime.subtype}`) { + constructor(mimeType: `${Mime.type}/${Mime.subtype}`) { if (!mimeType) { throw new Error(Messages.BUNDLE.MIME_TYPE_MISSING); } + + this[mimeTypeSymbol] = mimeType; } /** @@ -53,6 +57,14 @@ export default class Bundle { return [bundle, () => bundle[freezeSymbol]()]; } + /** + * Retrieves bundle's mimeType + */ + + public get mimeType() { + return this[mimeTypeSymbol]; + } + /** * Freezes the bundle so no more files * can be added any further.