Typed API client for npms
# NPM
npm install npms-lib
# Yarn
yarn add npms-lib
import * as npms from 'npms-lib';
const result = await npms.search({ query: 'typescript', size: 1 });
console.log(result.results[0].package.name); // typescript
-
search
: Returns specified number of packages that match the specified parameters. -
suggestions
: Likesearch
but with pre-set search parameters. -
info
: Returns information from one or more specified packages.
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;
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.