Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-dotenv

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-dotenv

Zero dependency .env to object parser

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.7K
increased by24.19%
Maintainers
1
Weekly downloads
 
Created
Source

parse-dotenv

Zero-dependency .env to javascript object parser

Travis (.org) Coverage Status

Installation

npm install parse-dotenv --save

Usage

# .env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
import parseEnv from "parse-dotenv";

const parsed = parseEnv();

console.log(parsed.DB_CONNECTION); // mysql

or provide a path (relative to project root) to env

const parseEnv = require("parse-dotenv");

const parsed = parseEnv(".env.example");
console.log(parsed.DB_PORT); // 3306

API

path

Type: string

Default: path.resolve(process.cwd(), '.env')

opts

Type: Object

opts.emptyLines

Type: boolean

Default: false

{
  emptyLines: false; // ignore empty lines in env
}
  • sync-dotenv - Keep your .env in sync with .env.example

LICENSE

This project is licensed under MIT

Keywords

FAQs

Package last updated on 22 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc