GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - webpod/envapi: An API to interact with environment files

BranchesTags
Open more actions menu

Latest commit

 

History

32 Commits
32 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

envapi

An API to interact with environment files

Install

npm install envapi

Usage

import { parse, stringify, config, load, loadSafe } from 'envapi'

const input = `A=A\nFOO=BAR`
const env = parse(input) // { A: 'A', FOO: 'BAR' }
const output = stringify(env) // A=A\nFOO=BAR

parse()

Parse a dotenv string into an object.

const raw = `
A=A
FOO=BAR #comment`

const env = parse(raw) // { A: 'A', FOO: 'BAR' }

stringify()

Stringify an object into a dotenv string.

const env = { A: 'A', FOO: 'BAR' }
const raw = stringify(env) // 'A=A\nFOO=BAR'

load()

Read a dotenv file(s) and parse it into an object. loadSafe() suppresses ENOENT errors.

await fs.writeFile('.env1', 'FOO=BAR')
await fs.writeFile('.env2', 'BAZ=QUX')

const env = load('.env1', '.env2')      // { FOO: 'BAR', BAZ: 'QUX' }
const _env = loadSafe('.env.notexists') // {}

config()

Load a dotenv file into process.env.

config('.env1')
process.env.FOO // BAR

License

MIT

About

An API to interact with environment files

Topics

configdotenvenv

Resources

Readme
MIT license
Activity
Custom properties

Stars

10 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.