Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
configjs-loader
Advanced tools
A simple script that loads json files into a config object for use in an app.
A simple config loader, that loads JSON files and returns an object of the loaded files and their contents.
It's a simple NPM package, so just run a normal NPM installation
npm i configjs-loader
See the test script below for example usage. All you need to supply as an argument is the directory that contains the config files. The script will attempt to recurse over that directory, finding all JSON files, and attempting to parse them. Returns a promise that must be awaited, which then returns the object of the configs loaded.
Configuration files are loaded into an object based on their filename. For example, if you have 2 config files, one.json and two.json, their properties will be loaded into {}.one and {}.two, respectively.
'use strict';
const configLoader = require("configjs-loader");
const path = require("path");
(async ()=>{
const conf = await configLoader(path.join(__dirname, "configs"));
console.log(conf);
})();
FAQs
A simple script that loads json files into a config object for use in an app.
We found that configjs-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.