UNPKG

@sigiljs/sigil

Version:

TypeScript-first Node.js HTTP framework offering schema-driven routing, modifier-based middleware, plugin extensibility, and flexible response templating

53 lines (52 loc) 1.16 kB
class t { /** Internal storage for constructor options. */ #e; /** Cached Blob representation of the file data. */ #i; /** * Constructs a new IncomingFile. * * @param options configuration options including buffer, names, and MIME type. */ constructor(e) { this.#e = e; } /** * MIME type of the file. */ get mimeType() { return this.#e.mimeType; } /** * Original filename provided by the client. */ get originalName() { return this.#e.originalName; } /** * Field key associated with this file in the form data. */ get incomingFileKey() { return this.#e.key; } /** * Returns a Blob representation of the file data. * Caches the Blob for subsequent calls. * * @returns blob containing the file's binary data and correct MIME type. */ blob() { return this.#i !== void 0 ? this.#i : (this.#i = new Blob([this.#e.buffer], { type: this.#e.mimeType }), this.#i); } /** * Returns the raw Buffer of the file data. * * @returns buffer containing the file's binary content. */ buffer() { return this.#e.buffer; } } export { t as default };