Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
reads a config file.
Using if available:
Can also watch a config file and all of its dependencies using chokidar
and recursive-uncache
.
npm install --save read-conf
readConf = require("read-conf")
// readConf(options:Object):Promise
conf = await readConf({name:"filename"})
conf.mtime // contains modified time of config file
// short form is allowed
packageJson = await readConf("package")
// has sophisticated watch functionality
unwatch = await readConf({name: "package",watch: true, cb: (conf) => {
// config has changed
// can be async
return await someStartup(conf)
}, cancel: () => {
// config has changed, but last cb didn't return yet
// cb will be called again, once this functions returns
// implement some sort of sleep to wait for other files to change
await Promise((resolve) => {setTimeout(resolve, 100)})
// can be async
return await someTearDown()
}})
unwatch() // once you want to cancel watching
// cb syntax also possible without watch
unwatch = await readConf({name: "package",watch: false, cb: (conf) => {
}})
unwatch() // empty function, save to call
Name | type | default | description |
---|---|---|---|
name | String | - | filename of the config |
extensions | Array | ["js","json","coffee","ts"] | extensions to look out for |
folders | Array or String | process.cwd() | folder(s) to search in, can be relative to cwd or absolute |
filename | String | - | absolute path to the config |
default | Object | - | the config will be merged into this |
assign | Object | - | this will be merged into the config |
cb | Function | - | callback which is called with config obj |
watch | Boolean | false | uses watch |
cancel | Function | - | only with watch . Is called on file change when cb is still busy |
## License
Copyright (c) 2017 Paul Pflugradt
Licensed under the MIT license.
FAQs
reads a config file
The npm package read-conf receives a total of 0 weekly downloads. As such, read-conf popularity was classified as not popular.
We found that read-conf 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.