summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.ns.d.ts
diff options
context:
space:
mode:
authorColin Ihrig <cjihrig@gmail.com>2022-11-09 08:14:25 -0500
committerGitHub <noreply@github.com>2022-11-09 14:14:25 +0100
commit0500aa1f71859772fba7c581e8cb2c1c4804dc2a (patch)
tree3b911502e3645455b0c94714ff2e2753f8058464 /cli/dts/lib.deno.ns.d.ts
parentf946806868ad37624ae96d1b31b882216bb80000 (diff)
feat: stabilize Deno.systemMemoryInfo() (#16445)
Diffstat (limited to 'cli/dts/lib.deno.ns.d.ts')
-rw-r--r--cli/dts/lib.deno.ns.d.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts
index b64e78af2..43c46754b 100644
--- a/cli/dts/lib.deno.ns.d.ts
+++ b/cli/dts/lib.deno.ns.d.ts
@@ -369,6 +369,49 @@ declare namespace Deno {
*/
export function networkInterfaces(): NetworkInterfaceInfo[];
+ /**
+ * Displays the total amount of free and used physical and swap memory in the
+ * system, as well as the buffers and caches used by the kernel.
+ *
+ * This is similar to the `free` command in Linux
+ *
+ * ```ts
+ * console.log(Deno.systemMemoryInfo());
+ * ```
+ *
+ * Requires `allow-sys` permission.
+ *
+ * @tags allow-sys
+ * @category Runtime Environment
+ */
+ export function systemMemoryInfo(): SystemMemoryInfo;
+
+ /**
+ * Information returned from a call to {@linkcode Deno.systemMemoryInfo}.
+ *
+ * @category Runtime Environment
+ */
+ export interface SystemMemoryInfo {
+ /** Total installed memory in bytes. */
+ total: number;
+ /** Unused memory in bytes. */
+ free: number;
+ /** Estimation of how much memory, in bytes, is available for starting new
+ * applications, without swapping. Unlike the data provided by the cache or
+ * free fields, this field takes into account page cache and also that not
+ * all reclaimable memory will be reclaimed due to items being in use.
+ */
+ available: number;
+ /** Memory used by kernel buffers. */
+ buffers: number;
+ /** Memory used by the page cache and slabs. */
+ cached: number;
+ /** Total swap memory. */
+ swapTotal: number;
+ /** Unused swap memory. */
+ swapFree: number;
+ }
+
/** Reflects the `NO_COLOR` environment variable at program start.
*
* When the value is `true`, the Deno CLI will attempt to not send color codes