UNPKG

tachijs

Version:

Highly testable dead simple web server written in Typescript

23 lines 853 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseResult_1 = require("./BaseResult"); class SendFileResult extends BaseResult_1.BaseResult { constructor(filePath, options = {}, callback, status = 200) { super(); this.filePath = filePath; this.options = options; this.callback = callback; this.status = status; } async execute(req, res, next) { if (this.callback != null) { const callback = this.callback; return res .status(this.status) .sendFile(this.filePath, this.options, (error) => callback(error, req, res, next)); } return res.status(this.status).sendFile(this.filePath, this.options); } } exports.SendFileResult = SendFileResult; //# sourceMappingURL=SendFileResult.js.map