diff options
author | Akshat Agarwal <humancalico@disroot.org> | 2020-09-10 14:08:17 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-10 10:38:17 +0200 |
commit | c1b4ff61c9113166705526022452ed2fb00bc7d5 (patch) | |
tree | cb13bf71b73566312c5767789c0e19ade6713a08 /cli/dts/lib.deno.unstable.d.ts | |
parent | dfd8794da463dd4d0649c41537b5475eaac10447 (diff) |
feat(unstable): Add Deno.systemMemoryInfo() (#7350)
Co-authored-by: marcopacini <pacinim88@gmail.com>
Co-authored-by: Casper Beyer <caspervonb@pm.me>
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r-- | cli/dts/lib.deno.unstable.d.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index 9c5590f97..fad31a3f2 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -130,6 +130,43 @@ declare namespace Deno { */ export function osRelease(): string; + /** **Unstable** new API. yet to be vetted. + * + * 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-env` permission. + * + */ + export function systemMemoryInfo(): SystemMemoryInfo; + + export interface SystemMemoryInfo { + /** Total installed memory */ + total: number; + /** Unused memory */ + free: number; + /** Estimation of how much memory 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 slabs 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; + } + /** **UNSTABLE**: new API, yet to be vetted. * * Open and initialize a plugin. |