Socket
Socket
Sign inDemoInstall

@contrast/find-package-json

Package Overview
Dependencies
Maintainers
9
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/find-package-json

Find the file's package.json


Version published
Maintainers
9
Created
Source

@contrast/find-package-json

This is derived from Sindre Sorhus' find-up-simple package. It has been modified so that it is CJS, lowers engine to >=16.9.1 in package.json, and only looks for package.json files.

Starting in the current directory (by default) and continuing up the parent directory chain, find package.json and return the absolute path or undefined.

Install

$ npm install @contrast/find-package-json

Usage

const { findPackageJsonAsync, findPackageJsonSync } = require('@contrast/find-package-json');

(async () => {
  console.log(await findPackageJsonAsync());
  //=> '/Users/contrast/find-package-json/package.json'
})();

console.log(findPackageJsonSync());
//=> '/Users/contrast/find-package-json/package.json'

API

  • findPackageJsonAsync([options])
  • findPackageJsonSync([options])

options

Type: object

  • cwd (string) - Directory to start from. Default: process.cwd()
  • stopAt (string) - Absolute path to stop at. Default: path.parse(cwd).root

Keywords

FAQs

Package last updated on 17 May 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc