
Security News
vlt Launches Real-Time Dependency Analysis Powered by Socket
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
fd-package-json
Advanced tools
Finds the closest package.json
and returns the path or the contents.
npm i -S fd-package-json
To retrieve the path of the closest package, you can use findPackagePath
:
import {findPackagePath} from 'fd-package-json';
// Closest package path to cwd of the process
await findPackagePath(process.cwd());
// Closest package path to the current file (CJS)
await findPackagePath(__dirname);
// Closest package path to the current file (ESM)
await findPackagePath(fileURLToPath(new URL('.', import.meta.url)));
To retrieve the package itself, you may use findPackage
with the same
parameter:
await findPackage(process.cwd()); // Returns the JSON of the package if found
Synchronous methods also exist:
findPackageSync(process.cwd()); // returns the package
findPackagePathSync(process.cwd()); // returns the package path
MIT
FAQs
Utilities for finding the closest package.json file
The npm package fd-package-json receives a total of 652,348 weekly downloads. As such, fd-package-json popularity was classified as popular.
We found that fd-package-json 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
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
Security News
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.