Skip to content

stevenvachon/edit-dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Edit a .env file string with preserved comments and whitespace.

Installation

Node.js >= 6 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
*/

About

Edit a .env file string with preserved comments and whitespace.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published