import { IncomingHttpEvent } from './IncomingHttpEvent.js'; import { IContainer } from '@stone-js/core'; import { File } from '@stone-js/filesystem'; import { OutgoingHttpResponse, OutgoingHttpResponseOptions } from './OutgoingHttpResponse.js'; /** * Options for creating a BinaryFile HTTP Response. */ export interface BinaryFileResponseOptions extends OutgoingHttpResponseOptions { autoEtag?: boolean; file: string | File; autoEncoding?: boolean; autoLastModified?: boolean; contentDispositionType?: string; } /** * Class representing a BinaryFileResponse. * * @author Mr. Stone */ export declare class BinaryFileResponse extends OutgoingHttpResponse { static readonly OUTGOING_HTTP_RESPONSE = "stonejs@outgoing_http_binary_file_response"; readonly file: File; private deleteFileAfterSent; /** * Create a BinaryFileResponse with inline content disposition. * * @param options - Options for creating the BinaryFileResponse. * @returns A new instance of BinaryFileResponse. */ static file(options: BinaryFileResponseOptions): BinaryFileResponse; /** * Create a BinaryFileResponse with attachment content disposition. * * @param options - Options for creating the BinaryFileResponse. * @returns A new instance of BinaryFileResponse. */ static download(options: BinaryFileResponseOptions): BinaryFileResponse; /** * Create a BinaryFileResponse. * * @param options - Options for creating the BinaryFileResponse. */ constructor(options: BinaryFileResponseOptions); /** * Get deleteFileAfterSent. * * @returns Whether the file should be deleted after being sent. */ get deleteFileAfterSentStatus(): boolean; /** * Get the encoded file path. * * @returns The encoded file path. */ getEncodedFilePath(): string; /** * Automatically set the ETag header based on the file's content. * * @returns The current instance for method chaining. */ autoEtag(): this; /** * Automatically set the Last-Modified header based on the file's modification time. * * @returns The current instance for method chaining. */ autoLastModified(): this; /** * Automatically set the Content-Encoding header based on the file's extension. * * @returns The current instance for method chaining. */ autoEncoding(): this; /** * Set the content disposition header. * * @param type - The content disposition type (e.g., 'inline', 'attachment'). * @returns The current instance for method chaining. */ setContentDisposition(type?: string): this; /** * Set the content of the response. * * @param content - The content to set (should be empty for BinaryFileResponse). * @returns The current instance for method chaining. * @throws TypeError if content is provided. */ setContent(content: unknown): this; /** * Get the content of the response. * * @returns False, as content cannot be set for BinaryFileResponse. */ getContent(): false; /** * Set whether the file should be deleted after being sent. * * @param shouldDelete - Whether to delete the file after being sent. * @returns The current instance for method chaining. */ setDeleteFileAfterSent(shouldDelete?: boolean): this; /** * Prepare the response before sending. * * @param event - The incoming HTTP event. * @param container - The service container. * @returns The current instance of the response for chaining. */ prepare(event: IncomingHttpEvent, container?: IContainer): this | Promise; /** * Prepare content-related headers. * * @returns The current instance for method chaining. */ protected prepareContentHeaders(): this; /** * Validate the file to be served. * * @param file - The file to be served. * @returns The validated file instance. */ private getValidatedFile; }