read-pkg
Read a package.json file
Last updated 8 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 (8 months ago)

6 Versions

  • 4.0.1                                ...           8 months ago
  • 4.0.0                                ...           8 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 3,416
This Week 30,600
This Month 183,629
Last Day 27,184
Last Week 110,850
Last Month 678,135
Dependencies (3)
Dev Dependencies (2)
Dependents (374)

Copyright 2014 - 2016 © taobao.org |