1 | declare module 'os' {
|
---|
2 | interface CpuInfo {
|
---|
3 | model: string;
|
---|
4 | speed: number;
|
---|
5 | times: {
|
---|
6 | user: number;
|
---|
7 | nice: number;
|
---|
8 | sys: number;
|
---|
9 | idle: number;
|
---|
10 | irq: number;
|
---|
11 | };
|
---|
12 | }
|
---|
13 |
|
---|
14 | interface NetworkInterfaceBase {
|
---|
15 | address: string;
|
---|
16 | netmask: string;
|
---|
17 | mac: string;
|
---|
18 | internal: boolean;
|
---|
19 | cidr: string | null;
|
---|
20 | }
|
---|
21 |
|
---|
22 | interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
|
---|
23 | family: "IPv4";
|
---|
24 | }
|
---|
25 |
|
---|
26 | interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
|
---|
27 | family: "IPv6";
|
---|
28 | scopeid: number;
|
---|
29 | }
|
---|
30 |
|
---|
31 | interface UserInfo<T> {
|
---|
32 | username: T;
|
---|
33 | uid: number;
|
---|
34 | gid: number;
|
---|
35 | shell: T;
|
---|
36 | homedir: T;
|
---|
37 | }
|
---|
38 |
|
---|
39 | type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
|
---|
40 |
|
---|
41 | function hostname(): string;
|
---|
42 | function loadavg(): number[];
|
---|
43 | function uptime(): number;
|
---|
44 | function freemem(): number;
|
---|
45 | function totalmem(): number;
|
---|
46 | function cpus(): CpuInfo[];
|
---|
47 | function type(): string;
|
---|
48 | function release(): string;
|
---|
49 | function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] };
|
---|
50 | function homedir(): string;
|
---|
51 | function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
|
---|
52 | function userInfo(options?: { encoding: string }): UserInfo<string>;
|
---|
53 | const constants: {
|
---|
54 | UV_UDP_REUSEADDR: number;
|
---|
55 | // signals: { [key in NodeJS.Signals]: number; }; @todo: change after migration to typescript 2.1
|
---|
56 | signals: {
|
---|
57 | SIGHUP: number;
|
---|
58 | SIGINT: number;
|
---|
59 | SIGQUIT: number;
|
---|
60 | SIGILL: number;
|
---|
61 | SIGTRAP: number;
|
---|
62 | SIGABRT: number;
|
---|
63 | SIGIOT: number;
|
---|
64 | SIGBUS: number;
|
---|
65 | SIGFPE: number;
|
---|
66 | SIGKILL: number;
|
---|
67 | SIGUSR1: number;
|
---|
68 | SIGSEGV: number;
|
---|
69 | SIGUSR2: number;
|
---|
70 | SIGPIPE: number;
|
---|
71 | SIGALRM: number;
|
---|
72 | SIGTERM: number;
|
---|
73 | SIGCHLD: number;
|
---|
74 | SIGSTKFLT: number;
|
---|
75 | SIGCONT: number;
|
---|
76 | SIGSTOP: number;
|
---|
77 | SIGTSTP: number;
|
---|
78 | SIGBREAK: number;
|
---|
79 | SIGTTIN: number;
|
---|
80 | SIGTTOU: number;
|
---|
81 | SIGURG: number;
|
---|
82 | SIGXCPU: number;
|
---|
83 | SIGXFSZ: number;
|
---|
84 | SIGVTALRM: number;
|
---|
85 | SIGPROF: number;
|
---|
86 | SIGWINCH: number;
|
---|
87 | SIGIO: number;
|
---|
88 | SIGPOLL: number;
|
---|
89 | SIGLOST: number;
|
---|
90 | SIGPWR: number;
|
---|
91 | SIGINFO: number;
|
---|
92 | SIGSYS: number;
|
---|
93 | SIGUNUSED: number;
|
---|
94 | };
|
---|
95 | errno: {
|
---|
96 | E2BIG: number;
|
---|
97 | EACCES: number;
|
---|
98 | EADDRINUSE: number;
|
---|
99 | EADDRNOTAVAIL: number;
|
---|
100 | EAFNOSUPPORT: number;
|
---|
101 | EAGAIN: number;
|
---|
102 | EALREADY: number;
|
---|
103 | EBADF: number;
|
---|
104 | EBADMSG: number;
|
---|
105 | EBUSY: number;
|
---|
106 | ECANCELED: number;
|
---|
107 | ECHILD: number;
|
---|
108 | ECONNABORTED: number;
|
---|
109 | ECONNREFUSED: number;
|
---|
110 | ECONNRESET: number;
|
---|
111 | EDEADLK: number;
|
---|
112 | EDESTADDRREQ: number;
|
---|
113 | EDOM: number;
|
---|
114 | EDQUOT: number;
|
---|
115 | EEXIST: number;
|
---|
116 | EFAULT: number;
|
---|
117 | EFBIG: number;
|
---|
118 | EHOSTUNREACH: number;
|
---|
119 | EIDRM: number;
|
---|
120 | EILSEQ: number;
|
---|
121 | EINPROGRESS: number;
|
---|
122 | EINTR: number;
|
---|
123 | EINVAL: number;
|
---|
124 | EIO: number;
|
---|
125 | EISCONN: number;
|
---|
126 | EISDIR: number;
|
---|
127 | ELOOP: number;
|
---|
128 | EMFILE: number;
|
---|
129 | EMLINK: number;
|
---|
130 | EMSGSIZE: number;
|
---|
131 | EMULTIHOP: number;
|
---|
132 | ENAMETOOLONG: number;
|
---|
133 | ENETDOWN: number;
|
---|
134 | ENETRESET: number;
|
---|
135 | ENETUNREACH: number;
|
---|
136 | ENFILE: number;
|
---|
137 | ENOBUFS: number;
|
---|
138 | ENODATA: number;
|
---|
139 | ENODEV: number;
|
---|
140 | ENOENT: number;
|
---|
141 | ENOEXEC: number;
|
---|
142 | ENOLCK: number;
|
---|
143 | ENOLINK: number;
|
---|
144 | ENOMEM: number;
|
---|
145 | ENOMSG: number;
|
---|
146 | ENOPROTOOPT: number;
|
---|
147 | ENOSPC: number;
|
---|
148 | ENOSR: number;
|
---|
149 | ENOSTR: number;
|
---|
150 | ENOSYS: number;
|
---|
151 | ENOTCONN: number;
|
---|
152 | ENOTDIR: number;
|
---|
153 | ENOTEMPTY: number;
|
---|
154 | ENOTSOCK: number;
|
---|
155 | ENOTSUP: number;
|
---|
156 | ENOTTY: number;
|
---|
157 | ENXIO: number;
|
---|
158 | EOPNOTSUPP: number;
|
---|
159 | EOVERFLOW: number;
|
---|
160 | EPERM: number;
|
---|
161 | EPIPE: number;
|
---|
162 | EPROTO: number;
|
---|
163 | EPROTONOSUPPORT: number;
|
---|
164 | EPROTOTYPE: number;
|
---|
165 | ERANGE: number;
|
---|
166 | EROFS: number;
|
---|
167 | ESPIPE: number;
|
---|
168 | ESRCH: number;
|
---|
169 | ESTALE: number;
|
---|
170 | ETIME: number;
|
---|
171 | ETIMEDOUT: number;
|
---|
172 | ETXTBSY: number;
|
---|
173 | EWOULDBLOCK: number;
|
---|
174 | EXDEV: number;
|
---|
175 | WSAEINTR: number;
|
---|
176 | WSAEBADF: number;
|
---|
177 | WSAEACCES: number;
|
---|
178 | WSAEFAULT: number;
|
---|
179 | WSAEINVAL: number;
|
---|
180 | WSAEMFILE: number;
|
---|
181 | WSAEWOULDBLOCK: number;
|
---|
182 | WSAEINPROGRESS: number;
|
---|
183 | WSAEALREADY: number;
|
---|
184 | WSAENOTSOCK: number;
|
---|
185 | WSAEDESTADDRREQ: number;
|
---|
186 | WSAEMSGSIZE: number;
|
---|
187 | WSAEPROTOTYPE: number;
|
---|
188 | WSAENOPROTOOPT: number;
|
---|
189 | WSAEPROTONOSUPPORT: number;
|
---|
190 | WSAESOCKTNOSUPPORT: number;
|
---|
191 | WSAEOPNOTSUPP: number;
|
---|
192 | WSAEPFNOSUPPORT: number;
|
---|
193 | WSAEAFNOSUPPORT: number;
|
---|
194 | WSAEADDRINUSE: number;
|
---|
195 | WSAEADDRNOTAVAIL: number;
|
---|
196 | WSAENETDOWN: number;
|
---|
197 | WSAENETUNREACH: number;
|
---|
198 | WSAENETRESET: number;
|
---|
199 | WSAECONNABORTED: number;
|
---|
200 | WSAECONNRESET: number;
|
---|
201 | WSAENOBUFS: number;
|
---|
202 | WSAEISCONN: number;
|
---|
203 | WSAENOTCONN: number;
|
---|
204 | WSAESHUTDOWN: number;
|
---|
205 | WSAETOOMANYREFS: number;
|
---|
206 | WSAETIMEDOUT: number;
|
---|
207 | WSAECONNREFUSED: number;
|
---|
208 | WSAELOOP: number;
|
---|
209 | WSAENAMETOOLONG: number;
|
---|
210 | WSAEHOSTDOWN: number;
|
---|
211 | WSAEHOSTUNREACH: number;
|
---|
212 | WSAENOTEMPTY: number;
|
---|
213 | WSAEPROCLIM: number;
|
---|
214 | WSAEUSERS: number;
|
---|
215 | WSAEDQUOT: number;
|
---|
216 | WSAESTALE: number;
|
---|
217 | WSAEREMOTE: number;
|
---|
218 | WSASYSNOTREADY: number;
|
---|
219 | WSAVERNOTSUPPORTED: number;
|
---|
220 | WSANOTINITIALISED: number;
|
---|
221 | WSAEDISCON: number;
|
---|
222 | WSAENOMORE: number;
|
---|
223 | WSAECANCELLED: number;
|
---|
224 | WSAEINVALIDPROCTABLE: number;
|
---|
225 | WSAEINVALIDPROVIDER: number;
|
---|
226 | WSAEPROVIDERFAILEDINIT: number;
|
---|
227 | WSASYSCALLFAILURE: number;
|
---|
228 | WSASERVICE_NOT_FOUND: number;
|
---|
229 | WSATYPE_NOT_FOUND: number;
|
---|
230 | WSA_E_NO_MORE: number;
|
---|
231 | WSA_E_CANCELLED: number;
|
---|
232 | WSAEREFUSED: number;
|
---|
233 | };
|
---|
234 | priority: {
|
---|
235 | PRIORITY_LOW: number;
|
---|
236 | PRIORITY_BELOW_NORMAL: number;
|
---|
237 | PRIORITY_NORMAL: number;
|
---|
238 | PRIORITY_ABOVE_NORMAL: number;
|
---|
239 | PRIORITY_HIGH: number;
|
---|
240 | PRIORITY_HIGHEST: number;
|
---|
241 | }
|
---|
242 | };
|
---|
243 | function arch(): string;
|
---|
244 | function platform(): NodeJS.Platform;
|
---|
245 | function tmpdir(): string;
|
---|
246 | const EOL: string;
|
---|
247 | function endianness(): "BE" | "LE";
|
---|
248 | /**
|
---|
249 | * Gets the priority of a process.
|
---|
250 | * Defaults to current process.
|
---|
251 | */
|
---|
252 | function getPriority(pid?: number): number;
|
---|
253 | /**
|
---|
254 | * Sets the priority of the current process.
|
---|
255 | * @param priority Must be in range of -20 to 19
|
---|
256 | */
|
---|
257 | function setPriority(priority: number): void;
|
---|
258 | /**
|
---|
259 | * Sets the priority of the process specified process.
|
---|
260 | * @param priority Must be in range of -20 to 19
|
---|
261 | */
|
---|
262 | function setPriority(pid: number, priority: number): void;
|
---|
263 | }
|
---|