This repository has been archived by the owner on Apr 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
81 lines (78 loc) · 1.95 KB
/
index.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
declare module 'net/http' {
export = http
}
declare namespace http {
export interface ServerOptions {
host?: string
port?: number
handler?: Handler
idleTimeout?: number
readTimeout?: number
writeTimeout?: number
maxHeaderBytes?: number
readHeaderTimeout?: number
}
export interface Cookie {
value: string
path?: string
domain?: string
expires?: string
rawExpires?: number
maxAge?: number
secure?: boolean
httpOnly?: boolean
raw?: string
}
export interface Content extends io.WriteCloser {
status: number
method: string
readonly path: string
readonly body: io.ReadCloser
readonly contentLength: number
readonly cookies: Map<string, Cookie>
readonly headers: Map<string, string>
getCookie(key: string): Cookie
delHeader (key: string): this
addHeader (key: string, value: string): this
setHeader (key: string, value: string): this
basicAuth (name: string, password: string, ok: boolean): this
addCookie (name: string, value: Cookie | string): this
}
export type Handler = (content: Content) => void
export class Server1 {
constructor (options: ServerOptions)
constructor (handler?: Handler, port?: number)
listen (): this
listenTLS (cert: string, key: string): this
close (): this
}
export function Server(handler?: Handler, port?: number): Server1
}
declare module 'io' {
export = io
}
declare namespace io {
export interface Closer {
close (bytes: Uint8Array)
}
export interface WriteCloser extends Closer {
write (bytes: Uint8Array): number
}
export interface ReadCloser extends Closer {
read (): Uint8Array
}
}
// declare class Url {
// constructor (url: string, base?: string)
// hash: string
// host: string
// hostname: string
// href: string
// origin: string
// password: string
// pathname: string
// port: string
// protocol: string
// search: string
// username: string
// }