const env = require("std/env");console.log(env.args()); // e.g. ["carne", "app.js", "--port", "3000"]console.log(env.getenv("HOME")); // string | undefinedconsole.log(env.parse("A=1\nB=x $A\n")); // {A: "1", B: "x 1"} (expansion applied)console.log(env.stringify({A: "1", B: "x y"})); // "A=1\nB=\"x y\"\n"env.load(); // reads ./.env into process envconsole.log(env.cwd()); // current directoryenv.exit(2); // terminate with exit code 2🔗env.args
env.args() -> process.argv as a fresh array
const env = require("std/env");env.args();🔗env.parse
env.parse(text) -> object (with variable expansion applied)
const env = require("std/env");env.parse("example");🔗env.stringify
env.stringify(obj) -> string (dotenv text, double-quoted when needed)
const env = require("std/env");env.stringify("example");🔗env.load
env.load([path][, override]) -> undefined (writes into process env)
const env = require("std/env");env.load("example", "example");🔗env.getenv
env.getenv("HOME") -> string | undefined
const env = require("std/env");env.getenv("key");🔗env.cwd
env.cwd() -> string
const env = require("std/env");env.cwd();🔗env.exit
env.exit(2) -> terminates the run with exit code 2
const env = require("std/env");env.exit(1000);