f
Deno.addSignalListener
Registers the given function as a listener of the given signal event.
```ts
Deno.addSignalListener(
"SIGTERM",
() => {
console.log("SIGTERM!")
}
);
```
_Note_: On Windows only `"SIGINT"` (CTRL+C) and `"SIGBREAK"` (CTRL+Break)
are supported.
f
Deno.chdir
Change the current working directory to the specified path.
```ts
Deno.chdir("/home/userA");
Deno.chdir("../userB");
Deno.chdir("C:\\Program Files (x86)\\Java");
```
Throws [`Deno.errors.NotFound`](./././~/Deno.errors.NotFound) if directory not found.
Throws [`Deno.errors.PermissionDenied`](./././~/Deno.errors.PermissionDenied) if the user does not have
operating system file access rights.
Requires `allow-read` permission.
f
Deno.cwd
Return a string representing the current working directory.
If the current directory can be reached via multiple paths (due to symbolic
links), `cwd()` may return any one of them.
```ts
const currentWorkingDirectory = Deno.cwd();
```
Throws [`Deno.errors.NotFound`](./././~/Deno.errors.NotFound) if directory not available.
Requires `allow-read` permission.
f
Deno.execPath
Returns the path to the current deno executable.
```ts
console.log(Deno.execPath()); // e.g. "/home/alice/.local/bin/deno"
```
Requires `allow-read` permission.
f
Deno.exit
Exit the Deno process with optional exit code.
If no exit code is supplied then Deno will exit with return code of `0`.
In worker contexts this is an alias to `self.close();`.
```ts
Deno.exit(5);
```
f
Deno.gid
Returns the group id of the process on POSIX platforms. Returns null on windows.
```ts
console.log(Deno.gid());
```
Requires `allow-sys` permission.
f
Deno.hostname
Get the `hostname` of the machine the Deno process is running on.
```ts
console.log(Deno.hostname());
```
Requires `allow-sys` permission.
f
Deno.loadavg
Returns an array containing the 1, 5, and 15 minute load averages. The
load average is a measure of CPU and IO utilization of the last one, five,
and 15 minute periods expressed as a fractional number. Zero means there
is no load. On Windows, the three values are always the same and represent
the current load, not the 1, 5 and 15 minute load averages.
```ts
console.log(Deno.loadavg()); // e.g. [ 0.71, 0.44, 0.44 ]
```
Requires `allow-sys` permission.
On Windows there is no API available to retrieve this information and this method returns `[ 0, 0, 0 ]`.
f
Deno.memoryUsage
Returns an object describing the memory usage of the Deno process and the
V8 subsystem measured in bytes.
f
Deno.osRelease
Returns the release version of the Operating System.
```ts
console.log(Deno.osRelease());
```
Requires `allow-sys` permission.
Under consideration to possibly move to Deno.build or Deno.versions and if
it should depend sys-info, which may not be desirable.
f
Deno.osUptime
Returns the Operating System uptime in number of seconds.
```ts
console.log(Deno.osUptime());
```
Requires `allow-sys` permission.
f
Deno.refTimer
Make the timer of the given `id` block the event loop from finishing.
f
Deno.removeSignalListener
Removes the given signal listener that has been registered with
[`Deno.addSignalListener`](./././~/Deno.addSignalListener).
```ts
const listener = () => {
console.log("SIGTERM!")
};
Deno.addSignalListener("SIGTERM", listener);
Deno.removeSignalListener("SIGTERM", listener);
```
_Note_: On Windows only `"SIGINT"` (CTRL+C) and `"SIGBREAK"` (CTRL+Break)
are supported.
f
Deno.systemMemoryInfo
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.
f
Deno.uid
Returns the user id of the process on POSIX platforms. Returns null on Windows.
```ts
console.log(Deno.uid());
```
Requires `allow-sys` permission.
f
Deno.unrefTimer
Make the timer of the given `id` not block the event loop from finishing.
I
I
I
T
Deno.Signal
Operating signals which can be listened for or sent to sub-processes. What
signals and what their standard behaviors are OS dependent.
v
Deno.args
Returns the script arguments to the program.
Give the following command line invocation of Deno:
```sh
deno run --allow-read https://examples.deno.land/command-line-arguments.ts Sushi
```
Then `Deno.args` will contain:
```ts
[ "Sushi" ]
```
If you are looking for a structured way to parse arguments, there is
[`parseArgs()`](https://jsr.io/@std/cli/doc/parse-args/~/parseArgs) from
the Deno Standard Library.
v
Deno.build
Information related to the build of the current Deno runtime.
Users are discouraged from code branching based on this information, as
assumptions about what is available in what build environment might change
over time. Developers should specifically sniff out the features they
intend to use.
The intended use for the information is for logging and debugging purposes.
v
Deno.env
An interface containing methods to interact with the process environment
variables.
v
Deno.exitCode
The exit code for the Deno process.
If no exit code has been supplied, then Deno will assume a return code of `0`.
When setting an exit code value, a number or non-NaN string must be provided,
otherwise a TypeError will be thrown.
```ts
console.log(Deno.exitCode); //-> 0
Deno.exitCode = 1;
console.log(Deno.exitCode); //-> 1
```
v
Deno.mainModule
The URL of the entrypoint module entered from the command-line. It
requires read permission to the CWD.
Also see `ImportMeta` for other related information.
v
Deno.noColor
Reflects the `NO_COLOR` environment variable at program start.
When the value is `true`, the Deno CLI will attempt to not send color codes
to `stderr` or `stdout` and other command line programs should also attempt
to respect this value.
See: https://no-color.org/
v
Deno.pid
The current process ID of this instance of the Deno CLI.
```ts
console.log(Deno.pid);
```
v
Deno.ppid
The process ID of parent process of this instance of the Deno CLI.
```ts
console.log(Deno.ppid);
```
v
Deno.version
Version information related to the current Deno CLI runtime environment.
Users are discouraged from code branching based on this information, as
assumptions about what is available in what build environment might change
over time. Developers should specifically sniff out the features they
intend to use.
The intended use for the information is for logging and debugging purposes.