env/dotenv.ts

Dotenv file parsing and loading.

Provides parse_dotenv for parsing dotenv-format strings and load_env_file for reading and parsing env files from disk.

Declarations
#

2 declarations

view source

load_env_file
#

env/dotenv.ts view source

(runtime: Pick<FsReadDeps, "read_file">, path: string): Promise<Record<string, string> | null>

Load and parse an env file.

runtime

runtime with read_file capability

type Pick<FsReadDeps, "read_file">

path

path to env file

type string

returns

Promise<Record<string, string> | null>

parsed env record, or null if file doesn't exist

parse_dotenv
#

env/dotenv.ts view source

(content: string): Record<string, string>

Parse a dotenv-format string into a record.

content

dotenv file content

type string

returns

Record<string, string>

parsed key-value pairs