package
Edit a .env file string with preserved whitespace.
npm install edit-dotenvGitHub-flavored package documentation.
Across all versions, last 30 days.
39,207 in 30 days
Runtime metadata.
Tagged topics.
Edit a
.envfile string with preserved whitespace.
Node.js >= 4 is required. To install, type this at the command line:
npm install edit-dotenvconst 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
*/Estimated unpacked size across 3 packages.
20.8 kB
Includes dependencies.