npms-lib
Typed API client for npms
Contents
Installation
# NPM
npm install npms-lib
# Yarn
yarn add npms-lib
Example
import * as npms from 'npms-lib';
const result = await npms.search({ query: 'typescript', size: 1 });
console.log(result.results[0].package.name);
API Reference
-
search: Returns specified number of packages that match the specified parameters.
-
suggestions: Like search but with pre-set search parameters.
-
info: Returns information from one or more specified packages.
Use with Node.js
The library assumes it's running on a browser, so it relays on the fetch API.
node-fetch is a good option:
import fetch from 'node-fetch';
import * as npms from 'npms-lib';
npms.config.fetch = fetch;
License
All the files in the repository are subject to the MIT license. Please refer to the License file at the root of the project to know more about it.