New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

env-file-parser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-file-parser

Parses env files into plain objects

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
185
-26.29%
Maintainers
1
Weekly downloads
 
Created
Source

env-file-parser

npm version Build Status Coverage Status Dependency Status

Parses an env file into a plain object.

Example


// ./file.env
// it works = true
// # it most definitely does.

// ./file.js
const {parse} = require('env-file-parser')
parser('./file.env').then(result => {
  assert.deepEqual(result, {'it works': true})
})

Env files

  • Whitespace is trimmed from values
  • You can include quotes around values to include whitespace
  • Comments start with a #
  • Blank lines are ignored
  • true/false values are parsed into booleans

API

  • parse parses the provided file, returns a promise resolved to a plain object
  • parseSync parses the provided file, returns a plain object

In all cases, fs errors will be thrown back to you and no sanity check is done on input arguments. Give me junk, and junk you shall receive.

arguments:

  • {string} filePath - will be passed to the fs module to load the file. toString will be called on the result
  • {object} [options] - will be passed to readFile / readFileSync call
  • {function} [callback] - you can use node-style callbacks as well (parse only)

License

MIT

Keywords

env

FAQs

Package last updated on 29 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts