|
2 | 2 | // Leo <https://github.com/leomelzer>
|
3 | 3 | /// <reference types="node" />
|
4 | 4 |
|
5 |
| -import { FastifyPluginAsync, FastifyRequest, RouteOptions } from 'fastify' |
| 5 | +import { FastifyPluginAsync, FastifyRequest, RouteOptions, FastifyReply } from 'fastify' |
6 | 6 | import { Stats } from 'fs'
|
7 | 7 |
|
8 |
| -declare module 'fastify' { |
9 |
| - interface FastifyReply { |
10 |
| - sendFile(filename: string, rootPath?: string): FastifyReply; |
11 |
| - sendFile(filename: string, options?: fastifyStatic.SendOptions): FastifyReply; |
12 |
| - sendFile(filename: string, rootPath?: string, options?: fastifyStatic.SendOptions): FastifyReply; |
13 |
| - download(filepath: string, options?: fastifyStatic.SendOptions): FastifyReply; |
14 |
| - download(filepath: string, filename?: string): FastifyReply; |
15 |
| - download(filepath: string, filename?: string, options?: fastifyStatic.SendOptions): FastifyReply; |
16 |
| - } |
| 8 | +export interface StaticReplyMixin { |
| 9 | + sendFile(filename: string, rootPath?: string): FastifyReply; |
| 10 | + sendFile(filename: string, options?: fastifyStatic.SendOptions): FastifyReply; |
| 11 | + sendFile(filename: string, rootPath?: string, options?: fastifyStatic.SendOptions): FastifyReply; |
| 12 | + download(filepath: string, options?: fastifyStatic.SendOptions): FastifyReply; |
| 13 | + download(filepath: string, filename?: string): FastifyReply; |
| 14 | + download(filepath: string, filename?: string, options?: fastifyStatic.SendOptions): FastifyReply; |
17 | 15 | }
|
18 | 16 |
|
19 | 17 | type FastifyStaticPlugin = FastifyPluginAsync<NonNullable<fastifyStatic.FastifyStaticOptions>>;
|
|
0 commit comments