On this page

    M

    util.parseEnv

    History
    util.parseEnv(content): void
    Attributes
    content:string

    The raw contents of a .env file.

    Returns:Object

    Given an example .env file:

    const { parseEnv } = require('node:util');
    
    parseEnv('HELLO=world\nHELLO=oh my\n');
    // Returns: { HELLO: 'oh my' }
    import { parseEnv } from 'node:util';
    
    parseEnv('HELLO=world\nHELLO=oh my\n');
    // Returns: { HELLO: 'oh my' }