
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Require a module like
require()
but from a given path
$ npm install --save req-from
const reqFrom = require('req-from');
// There is a file at `./foo/bar.js`
reqFrom('foo', './bar');
Like require()
, throws when the module can't be found.
Returns null
instead of throwing when the module can't be found.
Type: string
Directory to require from.
Type: string
What you would use in require()
.
Create a partial using a bound function if you want to require from the same fromDir
multiple times:
const reqFromFoo = reqFrom.bind(null, 'foo');
reqFromFoo('./bar');
reqFromFoo('./baz');
MIT © Sindre Sorhus
FAQs
Require a module like `require()` but from a given path
The npm package req-from receives a total of 115,937 weekly downloads. As such, req-from popularity was classified as popular.
We found that req-from 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
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.