ts5deco-express-controller
Version:
TypeScript 5 Modern Decorator Express Controller Framework
38 lines • 1.18 kB
TypeScript
import { Response } from 'express';
import { BaseResponse } from './BaseResponse';
/**
* File response class for sending files
*
* @example
* ```typescript
* // Send file with original name
* return new FileResponse('/path/to/file.pdf');
*
* // Send file with custom download name
* return new FileResponse('/path/to/document.pdf', 'report.pdf');
*
* // Send file as attachment (force download)
* return new FileResponse('/path/to/file.zip', 'archive.zip', true);
* ```
*/
export declare class FileResponse extends BaseResponse {
readonly filePath: string;
readonly filename?: string | undefined;
readonly asAttachment: boolean;
constructor(filePath: string, filename?: string | undefined, asAttachment?: boolean);
send(res: Response): void;
}
/**
* Convenience methods for common file responses
*/
export declare class FileResponses {
/**
* Send file for inline viewing
*/
static inline(filePath: string, filename?: string): FileResponse;
/**
* Send file as attachment (force download)
*/
static attachment(filePath: string, filename?: string): FileResponse;
}
//# sourceMappingURL=FileResponse.d.ts.map