edit-dotenv

v1.0.4
Edit a .env file string with preserved whitespace.
dotenv whitespace

edit-dotenv NPM Version Linux Build Windows Build Coverage Status Dependency Monitor

Edit a .env file string with preserved whitespace.

Installation

Node.js >= 4 is required. To install, type this at the command line:

npm install edit-dotenv

Usage

const editDotenv = require('edit-dotenv');

const envString = `VAR1=value
VAR2=value

# Comment
VAR3=value\\nvalue`;

const changes = {
  VAR2: 'new value',
  NEW: 'value'
};

editDotenv(envString, changes);
/*↴
VAR1=value
VAR2=new value

# Comment
VAR3=value\\nvalue

NEW=value
*/
npm i edit-dotenv

Metadata

  • MIT
  • >= 4
  • Steven Vachon
  • released 7/12/2017

Downloads

Maintainers