read-pkg
Read a package.json file
Last updated 8 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm
$ cnpm install read-pkg 
SYNC missed versions from official npm registry.

read-pkg Build Status

Read a package.json file

Why

Install

$ npm install read-pkg

Usage

const readPkg = require('read-pkg');

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

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

API

readPkg(options?)

Returns a Promise<object> with the parsed JSON.

readPkg.sync(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.

Related


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.

Current Tags

  • 8.0.0                                ...           latest (2 years ago)

9 Versions

  • 8.0.0                                ...           2 years ago
  • 7.1.0                                ...           4 years ago
  • 7.0.0                                ...           4 years ago
  • 6.0.0                                ...           4 years ago
  • 4.0.1                                ...           7 years ago
  • 5.2.0                                ...           6 years ago
  • 2.0.0                                ...           9 years ago
  • 1.1.0                                ...           10 years ago
  • 3.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org