# npm-registry-package-info

> Get package info for one or more packages.

Latest version **1.0.5** (published 2016-03-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install npm-registry-package-info
pnpm add npm-registry-package-info
yarn add npm-registry-package-info
bun add npm-registry-package-info
```

Provides the command `pkginfo`.

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2016-03-08 |
| First published | 2016-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/npm-registry-package-info) |
| Module format | CommonJS |
| Dependencies | 11 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Athan Reines |
| Maintainers | kgryte |
| Keywords | npm, list, info, details, show, view, url, cli, utility, utilities, utils, util, package, registry, meta, pkg, get |

## Links

- npm: https://www.npmjs.com/package/npm-registry-package-info
- Repository: https://github.com/kgryte/npm-registry-package-info
- Homepage: https://github.com/kgryte/npm-registry-package-info#readme
- Issues: https://github.com/kgryte/npm-registry-package-info/issues
- npm.io page: https://npm.io/package/npm-registry-package-info

## Dependencies (11)

- [debug](https://npm.io/package/debug.md) ^2.2.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [utils-merge2](https://npm.io/package/utils-merge2.md) ^2.0.0
- [update-notifier](https://npm.io/package/update-notifier.md) ^0.6.0
- [utils-json-parse](https://npm.io/package/utils-json-parse.md) ^1.0.0
- [validate.io-object](https://npm.io/package/validate.io-object.md) ^1.0.4
- [validate.io-function](https://npm.io/package/validate.io-function.md) ^1.0.2
- [validate.io-string-primitive](https://npm.io/package/validate.io-string-primitive.md) ^1.0.0
- [validate.io-boolean-primitive](https://npm.io/package/validate.io-boolean-primitive.md) ^1.0.0
- [validate.io-nonnegative-integer](https://npm.io/package/validate.io-nonnegative-integer.md) ^1.0.0
- [validate.io-string-primitive-array](https://npm.io/package/validate.io-string-primitive-array.md) ^1.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2016-03-08
- 1.0.4 — 2016-03-08
- 1.0.3 — 2016-02-09
- 1.0.2 — 2016-02-09
- 1.0.1 — 2016-02-09
- 1.0.0 — 2016-01-03
- 0.0.0 — 2016-01-03

## README

Package Info
===
[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url]

> Get package information for one or more packages.


## Installation

``` bash
$ npm install npm-registry-package-info
```


## Usage

``` javascript
var pkginfo = require( 'npm-registry-package-info' );
```

#### pkginfo( opts, clbk )

Get package information for one or more packages.

``` javascript
var opts = {
	'packages': [
		'dstructs-matrix',
		'compute-erf',
		'utils-copy',
		'unknown_package_name'
	]	
};

pkginfo( opts, clbk );

function clbk( error, data ) {
	if ( error ) {
		throw error;
	}
	console.dir( data );
	/*
		{
			"meta": {
				"total": 4,
				"success": 3,
				"failure": 1
			},
			"data": {
				"dstructs-matrix": {...},
				"compute-erf": {...},
				"utils-copy": {...}
			},
			"failures": {
				"unknown_package_name": "Not Found"
			}
		}
	*/
}
```

The `function` accepts the following `options`:

*	__packages__: `array` of package names (*required*).
*	__registry__: registry. Default: `'registry.npmjs.org'`.
*	__port__: registry port. Default: `443` (HTTPS) or `80` (HTTP).
* 	__protocol__: registry protocol. Default: `'https'`.
* 	__latest__: `boolean` indicating whether to return only the __latest__ package information from a registry.

To query an alternative registry, set the relevant options.

``` javascript
var opts = {
	'packages': [
		'dstructs-array',
		'flow-map',
		'utils-merge2'
	],
	'registry': 'my.favorite.npm/registry',
	'port': 80,
	'latest': true,
	'protocol': 'http'
};

pkginfo( opts, clbk );
```


#### pkginfo.factory( opts, clbk )

Creates a reusable `function`.

``` javascript
var pkgs = [
	'dstructs-matrix',
	'compute-stdev',
	'compute-variance'
];

var get = pkginfo.factory( {'packages': pkgs}, clbk );

get();
get();
get();
// ...
```

The factory method accepts the same `options` as `pkginfo()`.


## Notes

*	If the module encounters an application-level `error` (e.g., no network connection, non-existent registry, etc), that `error` is returned immediately to the provided `callback`.
*	If the module encounters a downstream `error` (e.g., timeout, reset connection, etc), that `error` is included in the returned results under the `failures` field.


## Examples

``` javascript
var ls = require( 'npm-list-author-packages' );
var pkginfo = require( 'npm-registry-package-info' );

var opts = {
	'username': 'kgryte'
};

ls( opts, onList );

function onList( error, list ) {
	var opts;
	if ( error ) {
		throw error;
	}
	if ( !list.length ) {
		return;
	}
	opts = {
		'packages': list
	};
	pkginfo( opts, onInfo );
}

function onInfo( error, data ) {
	if ( error ) {
		throw error;
	}
	console.dir( data );
}
```

To run the example code from the top-level application directory,

``` bash
$ DEBUG=* node ./examples/index.js
```


---
## CLI

### Installation

To use the module as a general utility, install the module globally

``` bash
$ npm install -g npm-registry-package-info
```


### Usage

``` bash
Usage: pkginfo [options] pkg1 pkg2 ...

Options:

  -h,  --help                Print this message.
  -V,  --version             Print the package version.
  -p,  --port port           Registry port. Default: 443 (HTTPS) or 80 (HTTP).
       --registry registry   Registry. Default: 'registry.npmjs.org'.
       --protocol protocol   Registry protocol. Default: 'https'.
       --latest              Only return the latest package entry.
```


### Notes

*	If a package is successfully resolved, the package info is written to `stdout`.
*	If a package cannot be resolved due to a downstream `error` (failure), the package (and its associated `error`) is written to `sterr`.
*	Output order is __not__ guaranteed to match input order.


### Examples

``` bash
$ DEBUG=* pkginfo dstructs-matrix compute-erf utils-copy
# => {...}
```


---
## Tests

### Unit

This repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory:

``` bash
$ make test
```

All new feature development should have corresponding unit tests to validate correct functionality.


### Test Coverage

This repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

``` bash
$ make test-cov
```

Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,

``` bash
$ make view-cov
```


### Browser Support

This repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:

``` bash
$ make test-browsers
```

To view the tests in a local web browser,

``` bash
$ make view-browser-tests
```

<!-- [![browser support][browsers-image]][browsers-url] -->


---
## License

[MIT license](http://opensource.org/licenses/MIT).


## Copyright

Copyright &copy; 2016. Athan Reines.


[npm-image]: http://img.shields.io/npm/v/npm-registry-package-info.svg
[npm-url]: https://npmjs.org/package/npm-registry-package-info

[build-image]: http://img.shields.io/travis/kgryte/npm-registry-package-info/master.svg
[build-url]: https://travis-ci.org/kgryte/npm-registry-package-info

[coverage-image]: https://img.shields.io/codecov/c/github/kgryte/npm-registry-package-info/master.svg
[coverage-url]: https://codecov.io/github/kgryte/npm-registry-package-info?branch=master

[dependencies-image]: http://img.shields.io/david/kgryte/npm-registry-package-info.svg
[dependencies-url]: https://david-dm.org/kgryte/npm-registry-package-info

[dev-dependencies-image]: http://img.shields.io/david/dev/kgryte/npm-registry-package-info.svg
[dev-dependencies-url]: https://david-dm.org/dev/kgryte/npm-registry-package-info

[github-issues-image]: http://img.shields.io/github/issues/kgryte/npm-registry-package-info.svg
[github-issues-url]: https://github.com/kgryte/npm-registry-package-info/issues

[tape]: https://github.com/substack/tape
[istanbul]: https://github.com/gotwarlost/istanbul
[testling]: https://ci.testling.com

---
_Source: https://npm.io/package/npm-registry-package-info · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
