1 | import { ParameterizedContext } from "koa";
|
2 |
|
3 | import { Stats } from "fs";
|
4 |
|
5 | declare function send(ctx: ParameterizedContext, path: string, opts?: send.SendOptions): Promise<string>;
|
6 |
|
7 | declare namespace send {
|
8 | type SetHeaders = (res: ParameterizedContext["res"], path: string, stats: Stats) => any;
|
9 |
|
10 | interface SendOptions {
|
11 | /** Browser cache max-age in milliseconds. (defaults to 0) */
|
12 | maxage?: number | undefined;
|
13 | maxAge?: SendOptions["maxage"] | undefined;
|
14 | /** Tell the browser the resource is immutable and can be cached indefinitely. (defaults to false) */
|
15 | immutable?: boolean | undefined;
|
16 | /** Allow transfer of hidden files. (defaults to false) */
|
17 | hidden?: boolean | undefined;
|
18 | /** Root directory to restrict file access. (defaults to '') */
|
19 | root?: string | undefined;
|
20 | /** Name of the index file to serve automatically when visiting the root location. (defaults to none) */
|
21 | index?: string | false | undefined;
|
22 | /** Try to serve the gzipped version of a file automatically when gzip is supported by a client and if the requested file with .gz extension exists. (defaults to true). */
|
23 | gzip?: boolean | undefined;
|
24 | /** Try to serve the brotli version of a file automatically when brotli is supported by a client and if the requested file with .br extension exists. (defaults to true). */
|
25 | brotli?: boolean | undefined;
|
26 | /** If not false (defaults to true), format the path to serve static file servers and not require a trailing slash for directories, so that you can do both /directory and /directory/. */
|
27 | format?: boolean | undefined;
|
28 | /** Function to set custom headers on response. */
|
29 | setHeaders?: SetHeaders | undefined;
|
30 | /** Try to match extensions from passed array to search for file when no extension is sufficed in URL. First found is served. (defaults to false) */
|
31 | extensions?: string[] | false | undefined;
|
32 | }
|
33 | }
|
34 |
|
35 | export = send;
|