1 | # Installation
|
2 | > `npm install --save @types/koa-send`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for koa-send (https://github.com/koajs/send).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-send.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-send/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for koa-send 4.1
|
12 | // Project: https://github.com/koajs/send
|
13 | // Definitions by: Peter Safranek <https://github.com/pe8ter>
|
14 | // Tomek Łaziuk <https://github.com/tlaziuk>
|
15 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
16 | // TypeScript Version: 2.3
|
17 |
|
18 | import {
|
19 | ParameterizedContext,
|
20 | } from "koa";
|
21 |
|
22 | import {
|
23 | Stats,
|
24 | } from "fs";
|
25 |
|
26 | declare function send(ctx: ParameterizedContext, path: string, opts?: send.SendOptions): Promise<string>;
|
27 |
|
28 | declare namespace send {
|
29 | type SetHeaders = (res: ParameterizedContext["res"], path: string, stats: Stats) => any;
|
30 |
|
31 | interface SendOptions {
|
32 | /** Browser cache max-age in milliseconds. (defaults to 0) */
|
33 | maxage?: number | undefined;
|
34 | maxAge?: SendOptions["maxage"] | undefined;
|
35 | /** Tell the browser the resource is immutable and can be cached indefinitely. (defaults to false) */
|
36 | immutable?: boolean | undefined;
|
37 | /** Allow transfer of hidden files. (defaults to false) */
|
38 | hidden?: boolean | undefined;
|
39 | /** Root directory to restrict file access. (defaults to '') */
|
40 | root?: string | undefined;
|
41 | /** Name of the index file to serve automatically when visiting the root location. (defaults to none) */
|
42 | index?: string | false | undefined;
|
43 | /** 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). */
|
44 | gzip?: boolean | undefined;
|
45 | /** 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). */
|
46 | brotli?: boolean | undefined;
|
47 | /** 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/. */
|
48 | format?: boolean | undefined;
|
49 | /** Function to set custom headers on response. */
|
50 | setHeaders?: SetHeaders | undefined;
|
51 | /** 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) */
|
52 | extensions?: string[] | false | undefined;
|
53 | }
|
54 | }
|
55 |
|
56 | export = send;
|
57 |
|
58 | ````
|
59 |
|
60 | ### Additional Details
|
61 | * Last updated: Tue, 06 Jul 2021 22:02:38 GMT
|
62 | * Dependencies: [@types/koa](https://npmjs.com/package/@types/koa)
|
63 | * Global values: none
|
64 |
|
65 | # Credits
|
66 | These definitions were written by [Peter Safranek](https://github.com/pe8ter), and [Tomek Łaziuk](https://github.com/tlaziuk).
|
67 |
|
\ | No newline at end of file |