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

parsenv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsenv - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

LICENSE

12

package.json
{
"name": "parsenv",
"version": "1.0.0",
"version": "1.0.1",
"description": "Edit, Save or Load variables from .env ( For Nodejs )",

@@ -23,5 +23,13 @@ "main": "src/index.js",

"homepage": "https://github.com/heinthanth/parsenv-node#readme",
"keywords": [
".env",
"env",
"node",
"process.env",
"variable",
"environment variable"
],
"dependencies": {
"dotenv": "github:motdotla/dotenv"
}
}
}
# ParsEnv
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
Edit, Save or Load variables from .env ( For Nodejs )

@@ -8,1 +10,66 @@

Since [motdotla/dotenv](https://github.com/motdotla/dotenv) can load variables from .env but can't save modified variables into .env, I just want to create this stuff.
## USAGE
### Load variables
```javascript
const dotenv = require("parsenv");
```
### Edit variables
```javascript
const dotenv = require("parsenv");
dotenv.edit({ VARIABLE: "value", ANOTHER: "another" });
```
### Save variables
```javascript
const dotenv = require("parsenv");
dotenv.write();
```
## EXAMPLE
```javascript
const parsenv = require("../src");
const p = require("path");
parsenv.config();
parsenv.edit({ NAME: "NAME CHANGED", ANOTHER_VARIABLE: "BAZ" });
parsenv.write({ path: p.join(__dirname, "../.env.modified") });
```
## CONFIGURATION
```javascript
const dotenv = require("parsenv");
const config = {
path: require('path').resolve(process.cwd(), ".env") # default
encoding: 'utf8' # default
debug: false # default
};
# config can apply to dotenv.config function
dotenv.config(config);
# also pass it to dotenv.write function
dotenv.write(config);
```
These settings and variables can be modified through `global.parsenv.setting` and `global.parsenv.env`. But recommend `edit` method to change variable
## LICENSE
`ParsEnv` is licensed under the MIT license. See [License](LICENSE) for more information.
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