read-pkg-up (6.0.0)

Published 2026-02-24 14:04:03 +00:00 by atheaadmin

Installation

registry=
npm install read-pkg-up@6.0.0
"read-pkg-up": "6.0.0"

About this package

read-pkg-up Build Status

Read the closest package.json file

Why

Install

$ npm install read-pkg-up

Usage

const readPkgUp = require('read-pkg-up');

(async () => {
	console.log(await readPkgUp());
	/*
	{
		package: {
			name: 'awesome-package',
			version: '1.0.0',
		},
		path: '/Users/sindresorhus/dev/awesome-package/package.json'
	}
	*/
})();

API

readPkgUp([options])

Returns a Promise<object> or Promise<undefined> if no package.json was found.

readPkgUp.sync([options])

Returns the result object or undefined if no package.json was found.

options

Type: object

cwd

Type: string
Default: process.cwd()

Directory to start looking for a package.json file.

normalize

Type: boolean
Default: true

Normalize the package data.

  • read-pkg - Read a package.json file
  • pkg-up - Find the closest package.json file
  • find-up - Find a file by walking up parent directories
  • pkg-conf - Get namespaced config from the closest package.json

License

MIT © Sindre Sorhus

Dependencies

Dependencies

ID Version
find-up ^4.0.0
read-pkg ^5.1.1
type-fest ^0.5.0

Development Dependencies

ID Version
ava ^1.4.1
tsd ^0.7.3
xo ^0.24.0

Keywords

json read parse file fs graceful load package find up find-up findup look-up look search match resolve parent parents folder directory walk walking path
Details
npm
2026-02-24 14:04:03 +00:00
0
Sindre Sorhus
MIT
2.5 KiB
Assets (1)
Versions (2) View all
6.0.0 2026-02-24
8.0.0 2026-02-24