read-pkg
Read a package.json file
Last updated 4 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 for 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

  • 4.0.1                                ...           latest (4 months ago)

6 Versions

  • 4.0.1                                ...           4 months ago
  • 4.0.0                                ...           4 months ago
  • 3.0.0                                ...           a year ago
  • 2.0.0                                ...           2 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 111
This Week 111
This Month 296,714
Last Day 4,185
Last Week 136,520
Last Month 419,179
Dependencies (3)
Dev Dependencies (2)
Dependents (305)

Copyright 2014 - 2016 © taobao.org |