Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

pkg-dir

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Issues
File Explorer

Advanced tools

pkg-dir

Find the root directory of a Node.js project or npm package

    7.0.0latest

Version published
Maintainers
1
Weekly downloads
55,184,133
increased by9.69%

Weekly downloads

Changelog

Source

Breaking

  • Require Node.js 14 b05b835
  • Fix TypeScript return type dea1a16

https://github.com/sindresorhus/pkg-dir/compare/v6.0.1...v7.0.0

Readme

Source

pkg-dir

Find the root directory of a Node.js project or npm package

Install

npm install pkg-dir

Usage

/ └── Users └── sindresorhus └── foo ├── package.json └── bar ├── baz └── example.js // example.js import {packageDirectory} from 'pkg-dir'; console.log(await packageDirectory()); //=> '/Users/sindresorhus/foo'

API

packageDirectory(option?)

Returns a Promise for either the project root path or undefined if it could not be found.

packageDirectorySync(options?)

Returns the project root path or undefined if it could not be found.

options

Type: object

cwd

Type: string
Default: process.cwd()

The directory to start searching from.

  • pkg-dir-cli - CLI for this module
  • pkg-up - Find the closest package.json file
  • find-up - Find a file by walking up parent directories

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

What is pkg-dir?

Find the root directory of a Node.js project or npm package

Is pkg-dir popular?

The npm package pkg-dir receives a total of 44,713,514 weekly downloads. As such, pkg-dir popularity was classified as popular.

Is pkg-dir well maintained?

We found that pkg-dir demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 16 Aug 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc