UNPKG

1.52 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/content-type`
3
4# Summary
5This package contains type definitions for content-type (https://github.com/jshttp/content-type).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/content-type.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/content-type/index.d.ts)
10````ts
11// Type definitions for content-type 1.1
12// Project: https://github.com/jshttp/content-type
13// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
14// BendingBender <https://github.com/BendingBender>
15// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
16
17export function parse(input: RequestLike | ResponseLike | string): ParsedMediaType;
18export function format(obj: MediaType): string;
19
20export interface ParsedMediaType {
21 type: string;
22 parameters: {[key: string]: string};
23}
24
25export interface MediaType {
26 type: string;
27 parameters?: {[key: string]: string} | undefined;
28}
29
30export interface RequestLike {
31 headers: {[header: string]: string | string[] | undefined};
32}
33
34export interface ResponseLike {
35 getHeader(name: string): number | string | string[] | undefined;
36}
37
38````
39
40### Additional Details
41 * Last updated: Fri, 09 Jul 2021 02:32:23 GMT
42 * Dependencies: none
43 * Global values: none
44
45# Credits
46These definitions were written by [Hiroki Horiuchi](https://github.com/horiuchi), and [BendingBender](https://github.com/BendingBender).
47
\No newline at end of file