-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MediaTypes.d.ts
142 lines (131 loc) · 5.02 KB
/
MediaTypes.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import { MIMEType } from 'node:util'
import { EventEmitter } from 'node:events'
type Versions = {
apache: string,
nginx: string,
debian: string
}
declare module '@jadsonlucena/mediatypes' {
/**
* @classdesc This is a comprehensive compilation of media types that may be periodically updated
*
* @emits MediaTypes#update
* @emits MediaTypes#error
*/
export default class MediaTypes {
/**
* Create a MediaType class
* @param {number} [updateInterval=86400000] - Periodic database update in milliseconds. if less than zero, will be disabled
* @see https://developer.mozilla.org/en-US/docs/Web/API/setInterval#delay
*
* @throws {TypeError} Invalid updateInterval
*/
constructor (updateInterval?: number)
/**
* @default '86400000'
*
* @throws {TypeError} Invalid updateInterval
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/setInterval#delay
*/
set updateInterval(param: number)
get updateInterval(): number
get versions(): Versions
get list(): Record<string, MIMEType[]>
/**
* @method
* @param {boolean} [force=false] - Force update even if no version changes
*
* @return {Promise<Object.<string, MIMEType[]>>} List of all extensions with their media types
*/
update(force?: boolean): Promise<Record<string, MIMEType[]>>
/**
* @param {string} path - File path
* @see https://nodejs.org/api/path.html#pathparsepath
*
* @throws {TypeError} Invalid path
* @throws {SyntaxError} Invalid extension
*
* @return {MIMEType[]}
*/
get(path: string): MIMEType[]
/**
* @param {string} extension - File extension
* @param {string} mediaType - {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#structure_of_a_mime_type IANA media types}
*
* @throws {TypeError|SyntaxError} Invalid extension
* @throws {TypeError|SyntaxError} Invalid mediaType
* @throws {AggregateError} Invalid arguments
*
* @return {boolean}
*/
set(extension: string, mediaType: string): boolean
/**
* @param {string} extension - File extension
* @param {string} mediaType - {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#structure_of_a_mime_type IANA media types}
*
* @throws {TypeError|SyntaxError} Invalid extension
* @throws {TypeError|SyntaxError} Invalid mediaType
* @throws {AggregateError} Invalid arguments
*
* @return {boolean}
*/
delete(extension: string, mediaType: string): boolean
/**
* @see https://nodejs.org/api/events.html#emitteraddlistenereventname-listener
*/
addListener(eventName: string | symbol, listener: (...args: any[]) => void): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emittereventnames
*/
eventNames(): (string | symbol)[]
/**
* @see https://nodejs.org/api/events.html#emittergetmaxlisteners
*/
getMaxListeners(): number
/**
* @see https://nodejs.org/api/events.html#emitterlistenercounteventname-listener
*/
listenerCount(eventName: string | symbol, listener?: Function | undefined): number
/**
* @see https://nodejs.org/api/events.html#emitterlistenerseventname
*/
listeners(eventName: string | symbol): Function[]
/**
* @see https://nodejs.org/api/events.html#emitteroffeventname-listener
*/
off(eventName: string | symbol, listener: (...args: any[]) => void): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emitteroneventname-listener
*/
on(eventName: string | symbol, listener: (...args: any[]) => void): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emitteronceeventname-listener
*/
once(eventName: string | symbol, listener: (...args: any[]) => void): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emitterprependlistenereventname-listener
*/
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emitterprependoncelistenereventname-listener
*/
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emitterremovealllistenerseventname
*/
removeAllListeners(event?: string | symbol | undefined): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emitterremovelistenereventname-listener
*/
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emittersetmaxlistenersn
*/
setMaxListeners(n: number): EventEmitter
/**
* @see https://nodejs.org/api/events.html#emitterrawlistenerseventname
*/
rawListeners(eventName: string | symbol): Function[]
}
}