typings: define types for os binding

PR-URL: https://github.com/nodejs/node/pull/40222
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Michaël Zasso 2021-09-26 16:28:40 +02:00
parent 70a5b86049
commit 9467cbadcb
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
2 changed files with 22 additions and 0 deletions

View File

@ -6,6 +6,7 @@
"./typings/internalBinding/http_parser.d.ts",
"./typings/internalBinding/messaging.d.ts",
"./typings/internalBinding/options.d.ts",
"./typings/internalBinding/os.d.ts",
"./typings/internalBinding/serdes.d.ts",
"./typings/internalBinding/timers.d.ts",
"./typings/internalBinding/util.d.ts",

21
typings/internalBinding/os.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
declare function InternalBinding(binding: 'os'): {
getHostname(ctx: {}): string | undefined;
getLoadAvg(array: Float64Array): void;
getUptime(): number;
getTotalMem(): number;
getFreeMem(): number;
getCPUs(): Array<string | number>;
getInterfaceAddresses(ctx: {}): Array<string | number | boolean> | undefined;
getHomeDirectory(ctx: {}): string | undefined;
getUserInfo(options: { encoding?: string } | undefined, ctx: {}): {
uid: number;
gid: number;
username: string;
homedir: string;
shell: string | null;
} | undefined;
setPriority(pid: number, priority: number, ctx: {}): number;
getPriority(pid: number, ctx: {}): number | undefined;
getOSInformation(ctx: {}): [sysname: string, version: string, release: string];
isBigEndian: boolean;
};