https://github.com/richienb/npms-api
A small wrapper around the npms.io api.
https://github.com/richienb/npms-api
Last synced: about 1 month ago
JSON representation
A small wrapper around the npms.io api.
- Host: GitHub
- URL: https://github.com/richienb/npms-api
- Owner: Richienb
- License: mit
- Created: 2020-02-23T09:01:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-02T15:56:26.000Z (over 5 years ago)
- Last Synced: 2025-02-18T20:45:02.145Z (11 months ago)
- Language: JavaScript
- Size: 87.9 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# NPMS Api [](https://travis-ci.com/Richienb/npms-api)
A small wrapper around the [npms.io api](https://api-docs.npms.io/).
[](https://npmjs.com/package/npms-api)
## Install
```sh
npm install npms-api
```
## Usage
```js
const { search, info } = require("npms-api");
(async () => {
await search("cross-spawn");
//=> { total: 45, results: [ { package: "cross-spawn", scope: "unscoped" ... } ... ] }
await info("cross-spawn");
//=> { analyzedAt: '2020-02-23T05:44:56.198Z', collected: { metadata: { name: "cross-spawn", scope: "unscoped" ... } ... } ... }
})();
```
## API
### npmsApi.search(query, options?)
#### query
Type: `string`
The query to search with.
#### options
Type: `object`
##### suggestions
Type: `boolean`\
Default: `false`
Return search suggestions.
##### offset
Type: `number`\
Default: `0`
The offset of the results. Not compatible with `suggestions`.
##### results
Type: `number`\
Default: `25`
The amount of results to return.
### npmsApi.info(name)
### npmsApi.info(names)
#### name
Type: `string|string[]`
The name/names of the packages.