From 7733b5e55decae66eb4721e91f1bd42d4e489bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 26 Sep 2021 16:28:40 +0200 Subject: [PATCH] typings: define types for os binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/40222 Reviewed-By: Tobias Nießen Reviewed-By: Evan Lucas Reviewed-By: Zijian Liu Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- tsconfig.json | 1 + typings/internalBinding/os.d.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 typings/internalBinding/os.d.ts diff --git a/tsconfig.json b/tsconfig.json index 25000c2655994e..048ecd6f48e3ee 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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", diff --git a/typings/internalBinding/os.d.ts b/typings/internalBinding/os.d.ts new file mode 100644 index 00000000000000..cdddc330151a3e --- /dev/null +++ b/typings/internalBinding/os.d.ts @@ -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; + getInterfaceAddresses(ctx: {}): Array | 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; +};