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