To handle file downloads, you can use the HttpResponse.sendFile
method. Here's an example:
import { HttpRequest, HttpResponse } from '@deepkit/http'; router.get('/download', (request: HttpRequest, response: HttpResponse) => { response.sendFile('/path/to/file.pdf', 'application/pdf', 'file.pdf'); });
In this example, the file at /path/to/file.pdf
will be sent as a download with the filename file.pdf
and the application/pdf
content type.