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


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

  • 5.2.0                                ...           latest (5 months ago)

10 Versions

  • 5.2.0                                ...           5 months ago
  • 5.1.1                                ...           8 months ago
  • 5.1.0                                ...           8 months ago
  • 5.0.0                                ...           9 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 1,932
This Week 248,941
This Month 539,299
Last Day 45,742
Last Week 277,018
Last Month 1,161,557
Dependencies (4)
Dev Dependencies (3)
Dependents (528)

Copyright 2014 - 2016 © taobao.org |