Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steelbrain/package-info
Get information about NPM packages
https://github.com/steelbrain/package-info
Last synced: 10 days ago
JSON representation
Get information about NPM packages
- Host: GitHub
- URL: https://github.com/steelbrain/package-info
- Owner: steelbrain
- License: mit
- Created: 2017-03-10T01:57:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-28T05:35:25.000Z (over 4 years ago)
- Last Synced: 2024-10-12T21:20:08.308Z (about 1 month ago)
- Language: JavaScript
- Size: 475 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Package-Info
===========[![Greenkeeper badge](https://badges.greenkeeper.io/steelbrain/package-info.svg)](https://greenkeeper.io/)
Package Info is an npm module to get details about any package published on the npm registry.
## Installation
```
npm install --save sb-package-info
```## API
```js
type PackageInfo = {
name: string,
version: string,
description: string,
scripts: Object,
dependencies: Object,
devDependencies: Object,versions: Object,
'dist-tags': Object,
}export default async function getPackageInfo(name: string, registryPrefix: ?string = null): Promise
```## Usage
```js
import getPackageInfo from 'sb-package-info'getPackageInfo('asdasd').catch(function(error) {
console.log(error.code) // MODULE_UNPUBLISHED
})
getPackageInfo('some-non-existent-module').catch(function(error) {
console.log(error.code) // MODULE_NOT_FOUND
})
getPackageInfo('php-serialize').then(function(contents) {
console.log('name', contents.name)
console.log('version', contents.version)
console.log('author', contents.author.name)
console.log('versions', Object.keys(contents.version))
})```
## License
This project is licensed under the terms of MIT License. See the License file for more info.