import * as _homer0_jimple from '@homer0/jimple'; import { J as Jimpex } from '../../index-DAUqbQ6h.js'; import { Response, NextFunction } from 'express'; import { PathUtils } from '@homer0/path-utils'; import '../../types/express.js'; import '../../types/http.js'; import 'https'; import 'http'; import 'spdy'; import 'node-fetch'; import '../../types/utils.js'; import '@homer0/simple-logger'; import '@homer0/simple-config'; import '@homer0/events-hub'; /** * The options to create a {@link SendFile} function. * * @group Services/SendFile */ type SendFileGeneratorOptions = { /** * A dictionary with the dependencies to inject. */ inject: { pathUtils: PathUtils; }; }; /** * The options for the function that actually serves a file. * * @group Services/SendFile */ type SendFileOptions = { /** * The response object sent by the application. Necessary to write the file. */ res: Response; /** * The path of the file to serve. Depending on the `from` option, it will be either * relative to the project root, or the application executable. */ filepath: string; /** * The name of a location on the `pathUtils` service from where the `filepath` is * relative to. It can be `app` for the directory containing the application executable, * or `project` for the project root. It could also be any other location that the * implementation may have registered. * * @default 'app' */ from?: string; /** * The function to move to the next middleware. It can be used to report an error in * case the file can't be served. * * @default {() => {}} */ next?: NextFunction; }; /** * The type of the function that serves a file. * This is exported to make it easy to type the dependency injection. * * @group Services/SendFile */ type SendFile = (options: SendFileOptions) => void; /** * Generates a function to send files on the application response. * * @param options To inject the required dependencies. * @example * *