--- title: "@std/dotenv" description: "Parsing and loading environment variables from a `.env` file" jsr: jsr:@std/dotenv pkg: dotenv version: 0.225.6 generated: true stability: unstable --- :::info Unstable This @std package is experimental and its API may change without a major version bump. ::: ## Overview

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_]*$/.

```js // Automatically load environment variables from a `.env` file import "@std/dotenv/load"; ``` ```js 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'"); ``` ### Add to your project ```sh deno add jsr:@std/dotenv ``` See all symbols in @std/dotenv on