Skip to main content
Deno.Env.toObject - Deno documentation
method Deno.Env.toObject
allow-env
Env.toObject(): { [index: string]: string; }

Returns a snapshot of the environment variables at invocation as a simple object of keys and values.

Deno.env.set("TEST_VAR", "A");
const myEnv = Deno.env.toObject();
console.log(myEnv.SHELL);
Deno.env.set("TEST_VAR", "B");
console.log(myEnv.TEST_VAR);  // outputs "A"

Requires allow-env permission.

Return Type

{ [index: string]: string; }
Back to top