UNPKG

1.56 kBTypeScriptView Raw
1// Type definitions for mime-db 1.43
2// Project: https://github.com/jshttp/mime-db
3// Definitions by: AJP <https://github.com/AJamesPhillips>
4// Linus Unnebäck <https://github.com/LinusU>
5// Piotr Błażejewicz <https://github.com/peterblazejewicz>
6// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
8declare namespace database {
9 /**
10 * @see {@link https://github.com/jshttp/mime-db#data-structure}
11 */
12 interface MimeEntry {
13 /**
14 * Where the mime type is defined.
15 * If not set, it's probably a custom media type.
16 */
17 readonly source?: MimeSource | undefined;
18 /** Known extensions associated with this mime type. */
19 readonly extensions?: ReadonlyArray<string> | undefined;
20 /** Whether a file of this type can be gzipped. */
21 readonly compressible?: boolean | undefined;
22 /** The default charset associated with this type, if any. */
23 readonly charset?: string | undefined;
24 }
25
26 /**
27 * @see {@link https://github.com/jshttp/mime-db#data-structure}
28 */
29 interface MimeDatabase {
30 readonly [type: string]: MimeEntry;
31 }
32
33 /**
34 * Sources:
35 * http://www.iana.org/assignments/media-types/media-types.xhtml
36 * http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
37 * http://hg.nginx.org/nginx/raw-file/default/conf/mime.types
38 */
39 type MimeSource = 'iana' | 'apache' | 'nginx';
40}
41
42declare const database: database.MimeDatabase;
43
44export = database;