Module dotenv/mod

    Parses and loads environment variables from a .env file into the current process, or stringify data into a .env file format.

    Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.

    // Automatically load environment variables from a `.env` file
    import "@std/dotenv/load";
    import { parse, stringify } from "@std/dotenv";
    import { assertEquals } from "@std/assert";

    assertEquals(parse("GREETING=hello world"), { GREETING: "hello world" });
    assertEquals(stringify({ GREETING: "hello world" }), "GREETING='hello world'");

    Index

    Interfaces

    Functions