123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- declare module 'os' {
- interface CpuInfo {
- model: string;
- speed: number;
- times: {
- user: number;
- nice: number;
- sys: number;
- idle: number;
- irq: number;
- };
- }
-
- interface NetworkInterfaceBase {
- address: string;
- netmask: string;
- mac: string;
- internal: boolean;
- cidr: string | null;
- }
-
- interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
- family: "IPv4";
- }
-
- interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
- family: "IPv6";
- scopeid: number;
- }
-
- interface UserInfo<T> {
- username: T;
- uid: number;
- gid: number;
- shell: T;
- homedir: T;
- }
-
- type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
-
- function hostname(): string;
- function loadavg(): number[];
- function uptime(): number;
- function freemem(): number;
- function totalmem(): number;
- function cpus(): CpuInfo[];
- function type(): string;
- function release(): string;
- function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
- function homedir(): string;
- function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
- function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
-
- type SignalConstants = {
- [key in NodeJS.Signals]: number;
- };
-
- namespace constants {
- const UV_UDP_REUSEADDR: number;
- namespace signals {}
- const signals: SignalConstants;
- namespace errno {
- const E2BIG: number;
- const EACCES: number;
- const EADDRINUSE: number;
- const EADDRNOTAVAIL: number;
- const EAFNOSUPPORT: number;
- const EAGAIN: number;
- const EALREADY: number;
- const EBADF: number;
- const EBADMSG: number;
- const EBUSY: number;
- const ECANCELED: number;
- const ECHILD: number;
- const ECONNABORTED: number;
- const ECONNREFUSED: number;
- const ECONNRESET: number;
- const EDEADLK: number;
- const EDESTADDRREQ: number;
- const EDOM: number;
- const EDQUOT: number;
- const EEXIST: number;
- const EFAULT: number;
- const EFBIG: number;
- const EHOSTUNREACH: number;
- const EIDRM: number;
- const EILSEQ: number;
- const EINPROGRESS: number;
- const EINTR: number;
- const EINVAL: number;
- const EIO: number;
- const EISCONN: number;
- const EISDIR: number;
- const ELOOP: number;
- const EMFILE: number;
- const EMLINK: number;
- const EMSGSIZE: number;
- const EMULTIHOP: number;
- const ENAMETOOLONG: number;
- const ENETDOWN: number;
- const ENETRESET: number;
- const ENETUNREACH: number;
- const ENFILE: number;
- const ENOBUFS: number;
- const ENODATA: number;
- const ENODEV: number;
- const ENOENT: number;
- const ENOEXEC: number;
- const ENOLCK: number;
- const ENOLINK: number;
- const ENOMEM: number;
- const ENOMSG: number;
- const ENOPROTOOPT: number;
- const ENOSPC: number;
- const ENOSR: number;
- const ENOSTR: number;
- const ENOSYS: number;
- const ENOTCONN: number;
- const ENOTDIR: number;
- const ENOTEMPTY: number;
- const ENOTSOCK: number;
- const ENOTSUP: number;
- const ENOTTY: number;
- const ENXIO: number;
- const EOPNOTSUPP: number;
- const EOVERFLOW: number;
- const EPERM: number;
- const EPIPE: number;
- const EPROTO: number;
- const EPROTONOSUPPORT: number;
- const EPROTOTYPE: number;
- const ERANGE: number;
- const EROFS: number;
- const ESPIPE: number;
- const ESRCH: number;
- const ESTALE: number;
- const ETIME: number;
- const ETIMEDOUT: number;
- const ETXTBSY: number;
- const EWOULDBLOCK: number;
- const EXDEV: number;
- const WSAEINTR: number;
- const WSAEBADF: number;
- const WSAEACCES: number;
- const WSAEFAULT: number;
- const WSAEINVAL: number;
- const WSAEMFILE: number;
- const WSAEWOULDBLOCK: number;
- const WSAEINPROGRESS: number;
- const WSAEALREADY: number;
- const WSAENOTSOCK: number;
- const WSAEDESTADDRREQ: number;
- const WSAEMSGSIZE: number;
- const WSAEPROTOTYPE: number;
- const WSAENOPROTOOPT: number;
- const WSAEPROTONOSUPPORT: number;
- const WSAESOCKTNOSUPPORT: number;
- const WSAEOPNOTSUPP: number;
- const WSAEPFNOSUPPORT: number;
- const WSAEAFNOSUPPORT: number;
- const WSAEADDRINUSE: number;
- const WSAEADDRNOTAVAIL: number;
- const WSAENETDOWN: number;
- const WSAENETUNREACH: number;
- const WSAENETRESET: number;
- const WSAECONNABORTED: number;
- const WSAECONNRESET: number;
- const WSAENOBUFS: number;
- const WSAEISCONN: number;
- const WSAENOTCONN: number;
- const WSAESHUTDOWN: number;
- const WSAETOOMANYREFS: number;
- const WSAETIMEDOUT: number;
- const WSAECONNREFUSED: number;
- const WSAELOOP: number;
- const WSAENAMETOOLONG: number;
- const WSAEHOSTDOWN: number;
- const WSAEHOSTUNREACH: number;
- const WSAENOTEMPTY: number;
- const WSAEPROCLIM: number;
- const WSAEUSERS: number;
- const WSAEDQUOT: number;
- const WSAESTALE: number;
- const WSAEREMOTE: number;
- const WSASYSNOTREADY: number;
- const WSAVERNOTSUPPORTED: number;
- const WSANOTINITIALISED: number;
- const WSAEDISCON: number;
- const WSAENOMORE: number;
- const WSAECANCELLED: number;
- const WSAEINVALIDPROCTABLE: number;
- const WSAEINVALIDPROVIDER: number;
- const WSAEPROVIDERFAILEDINIT: number;
- const WSASYSCALLFAILURE: number;
- const WSASERVICE_NOT_FOUND: number;
- const WSATYPE_NOT_FOUND: number;
- const WSA_E_NO_MORE: number;
- const WSA_E_CANCELLED: number;
- const WSAEREFUSED: number;
- }
- namespace priority {
- const PRIORITY_LOW: number;
- const PRIORITY_BELOW_NORMAL: number;
- const PRIORITY_NORMAL: number;
- const PRIORITY_ABOVE_NORMAL: number;
- const PRIORITY_HIGH: number;
- const PRIORITY_HIGHEST: number;
- }
- }
-
- function arch(): string;
- /**
- * Returns a string identifying the kernel version.
- * On POSIX systems, the operating system release is determined by calling
- * [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available,
- * `GetVersionExW()` will be used. See
- * https://en.wikipedia.org/wiki/Uname#Examples for more information.
- */
- function version(): string;
- function platform(): NodeJS.Platform;
- function tmpdir(): string;
- const EOL: string;
- function endianness(): "BE" | "LE";
- /**
- * Gets the priority of a process.
- * Defaults to current process.
- */
- function getPriority(pid?: number): number;
- /**
- * Sets the priority of the current process.
- * @param priority Must be in range of -20 to 19
- */
- function setPriority(priority: number): void;
- /**
- * Sets the priority of the process specified process.
- * @param priority Must be in range of -20 to 19
- */
- function setPriority(pid: number, priority: number): void;
- }
|