read-pkg (6.0.0)

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

Installation

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

About this package

read-pkg

Read a package.json file

Why

Install

$ npm install read-pkg

Usage

import {readPackageAsync} from 'read-pkg';

console.log(await readPkg());
//=> {name: 'read-pkg', …}

console.log(await readPkg({cwd: 'some-other-directory'}));
//=> {name: 'unicorn', …}

API

readPackageAsync(options?)

Returns a Promise<object> with the parsed JSON.

readPackageSync(options?)

Returns the parsed JSON.

options

Type: object

cwd

Type: string
Default: process.cwd()

Current working directory.

normalize

Type: boolean
Default: true

Normalize the package data.


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.

Dependencies

Dependencies

ID Version
@types/normalize-package-data ^2.4.0
normalize-package-data ^3.0.2
parse-json ^5.2.0
type-fest ^1.0.1

Development Dependencies

ID Version
ava ^3.15.0
tsd ^0.14.0
xo ^0.38.2

Keywords

json read parse file fs graceful load package normalize
Details
npm
2026-02-24 14:04:04 +00:00
0
Sindre Sorhus
MIT
latest
2.4 KiB
Assets (1)
Versions (2) View all
5.2.0 2026-02-24
6.0.0 2026-02-24