
Company News
Jerod Santo Joins Socket as Head of Media
Allow myself to introduce... myself.
devkits-env-parser
Advanced tools
Parse .env file content into JavaScript object. Zero dependencies, handles comments, quotes, and edge cases.
npm install -g devkits-env-parser
# Parse .env content to JSON
env-parser parse "FOO=bar\nBAZ=qux"
# Output: {"FOO":"bar","BAZ":"qux"}
# Parse with quotes
env-parser parse "DB_HOST=\"localhost\"\nPORT=5432"
# Stringify to .env format
env-parser stringify '{"DB_HOST":"localhost","PORT":"5432"}'
# Output: DB_HOST=localhost\nPORT=5432
# Parse .env file
env-parser file .env
# Quote all values
env-parser stringify '{"MSG":"hello world"}' --quote
# Output: MSG="hello world"
const { parse, stringify } = require('devkits-env-parser');
// Parse .env content
const config = parse(`
# Database settings
DB_HOST=localhost
DB_PORT=5432
DB_NAME="my database" # inline comment
`);
// { DB_HOST: 'localhost', DB_PORT: '5432', DB_NAME: 'my database' }
// Parse with quotes
parse('MESSAGE="hello world"');
// { MESSAGE: 'hello world' }
// Handle escaped quotes
parse('QUOTE="say \\"hello\\""');
// { QUOTE: 'say "hello"' }
// Stringify to .env format
stringify({ DB_HOST: 'localhost', PORT: '5432' });
// 'DB_HOST=localhost\nPORT=5432'
// Add comments
stringify(
{ DB_HOST: 'localhost' },
{ comments: { DB_HOST: 'Database host' } }
);
// 'DB_HOST=localhost # Database host'
// Quote all values
stringify({ MSG: 'hello world' }, { quote: true });
// 'MSG="hello world"'
parse(content)Parse .env file content into object.
| Param | Type | Description |
|---|---|---|
| content | string | .env file content |
| Returns | Object | Parsed key-value pairs |
Features:
KEY=value # comment)\" → ")stringify(obj, options)Stringify object into .env format.
| Param | Type | Description |
|---|---|---|
| obj | Object | Key-value pairs |
| options | Object | Options |
| options.quote | boolean | Quote all values (default: false) |
| options.comments | Object | Add comments to keys |
| Returns | string | .env file content |
// Load and parse .env file
const fs = require('fs');
const { parse } = require('devkits-env-parser');
const content = fs.readFileSync('.env', 'utf8');
const config = parse(content);
// Generate .env from template
const { stringify } = require('devkits-env-parser');
const envContent = stringify({
NODE_ENV: 'production',
PORT: '3000',
API_KEY: process.env.API_KEY
}, {
comments: {
NODE_ENV: 'Environment',
PORT: 'Server port'
}
});
\" and \'Open Collective: Open Collective - DevKits
Crypto: ETH/USDC 0xDea4a6A20fCB44467e45Ef378972F54B22dC59db
MIT — DevKits Team
FAQs
Parse .env file content into JavaScript object — zero dependencies
We found that devkits-env-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Allow myself to introduce... myself.

Research
/Security News
A Twitch browser extension on Chrome and Firefox forwards users’ live OAuth session tokens through proxies controlled by a Russian bot service.

Security News
Anthropic found biased reasoning and recklessness drove Claude Mythos 5 to publish malware on PyPI and compromise a security vendor.