read-pkg
Read a package.json file
Last updated 2 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ 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

License

MIT © Sindre Sorhus

Current Tags

  • 5.1.1                                ...           latest (2 months ago)

9 Versions

  • 5.1.1                                ...           2 months ago
  • 5.1.0                                ...           2 months ago
  • 5.0.0                                ...           4 months ago
  • 4.0.1                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.0.0                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 35,747
This Week 116,644
This Month 736,489
Last Day 40,746
Last Week 216,370
Last Month 901,335
Dependencies (4)
Dev Dependencies (3)
Dependents (447)

Copyright 2014 - 2017 © taobao.org |