UNPKG

@sigiljs/sigil

Version:

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

22 lines (21 loc) 779 B
import { default as SigilResponse } from './sigil-response'; /** * Response class for serving files. * Encapsulates a file path as the response content and sets appropriate headers. * * Automatically sets Content-Encoding and optional Content-Type headers. */ export default class FileResponse extends SigilResponse { /** * HTTP status code for file responses (defaults to 200). */ code: number; /** * Constructs a new FileResponse. * * @param path - Filesystem path to the file to serve. * @param contentType - Optional MIME type of the file (e.g., "image/png"). * @param encoding - Text encoding for file content (defaults to "utf8"). */ constructor(path: string, contentType?: string, encoding?: BufferEncoding); }