diff options
author | ecyrbe <ecyrbe@gmail.com> | 2020-02-23 00:46:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 18:46:52 -0500 |
commit | fb98556d56d0defa325fab1296077627cce31aab (patch) | |
tree | c5589b7cdc21d56d440ab13a1abc527cf072b103 /cli/js/os.ts | |
parent | c34d96d86557d434bdf124063e4eec4662067c1e (diff) |
feat(std/node): add os.loadavg() (#4075)
Diffstat (limited to 'cli/js/os.ts')
-rw-r--r-- | cli/js/os.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/js/os.ts b/cli/js/os.ts index 275dbdf1d..d3c0d1b72 100644 --- a/cli/js/os.ts +++ b/cli/js/os.ts @@ -11,6 +11,14 @@ import * as util from "./util.ts"; export function isTTY(): { stdin: boolean; stdout: boolean; stderr: boolean } { return sendSync(dispatch.OP_IS_TTY); } +/** Get the loadavg. + * Requires the `--allow-env` flag. + * + * console.log(Deno.loadavg()); + */ +export function loadavg(): number[] { + return sendSync(dispatch.OP_LOADAVG); +} /** Get the hostname. * Requires the `--allow-env` flag. |