Modern package for managing environment variables Files with extension ".env", zero-dependency in the package and easily you can access data in process.env and you can modify and read the data for more details you can read below the method of registering and deleting variables
.env
files easily and quickly!node -r files.env/config index.js
Install with npm / yarn / pnpm:
npm install files.env
yarn add files.env
pnpm add files.env
require("files.env").config()
process.env //FileEnv class will be returned to you
import { config} from 'files.env';
config()
process.env//FileEnv class will be returned to you
import { FileEnv } from 'files.env';
const env = new FileEnv()
env//FileEnv class will be returned to you
⚠️ Note
in the event that you were a TypeScript Why shouldn't you use the config function and instead use the class??
You must know that process.env has an interface and this interface we cannot modify, so you cannot make the methods available through process.env so if you do a config only you will be able to read so you must use the FileEnv
class so that you can read and write
$ node -r files.env/config index.js
// Read variable from file
process.env.set("name","Mohamed Abdelkarim")//Add a variable in the env . file
//Read variables in the file
console.log(process.env.name)// return "Mohamed Abdelkarim"
//or console.log(process.env.get("name"))
//Delete variable from file
process.env.delete("name")
//Check if a variable exists in the file
console.log(process.env.has("name"))
//To write an object to the file
process.env.writeFile({token:"11",prefix:"#"})
//Delete all variables from the file
process.env.clear()
//Delete and destroy the file
process.env.destroy()
//If you have modified the file and it is running, you can make the package re-read the variables in the file through this method
process.env.reloadVariables()//Only in the event that you have modified the file and not from methods or if you want to re-make the package to re-read the file!
import { parse, stringify } from 'files.env';
console.log(parse('name="Mohamed"')) // return {"name":"Mohamed"}
console.log(stringify({name:"Mohamed"})) // return name="Mohamed"
# Registration information
Name="Mohamed Abdelkarim"
UUID="3cae8d3c-5219-11ed-bdc3-0242ac120002"
# API
Token="12"# your token!
You can see the Documentation of the st.db package to know all the details
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official Discord Server .
Generated using TypeDoc