Skip to content

parseEnv

parseEnv(source, options?): Record<string, string>

Defined in: env/parse-env.ts:112

Parse a whole environment document into its variables, keyed by name.

A later assignment to the same name wins, as it does in a shell. In the quoted syntaxes a value may span lines, which is how a PEM key or a JSON blob reaches a .env file.

string

The document to parse.

ParseEnvOptions

Options for parsing the document.

Record<string, string>

The parsed variables. Values are always strings; see parseEnvValueAsNumber and parseEnvValueAsBool to read one as something else.