Skip to main content

@std/dotenv@0.225.2
Built and signed on GitHub Actions

UNSTABLE: Parsing and loading environment variables from a `.env` file

This package works with DenoIt is unknown whether this package works with Bun
This package works with Deno
It is unknown whether this package works with Bun
JSR Score
94%
Published
3 months ago (0.225.2)

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'");
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@std/dotenv

Import symbol

import * as dotenv from "@std/dotenv";

---- OR ----

Import directly with a jsr specifier

import * as dotenv from "jsr:@std/dotenv";

Add Package

bunx jsr add @std/dotenv

Import symbol

import * as dotenv from "@std/dotenv";