Node.js SDK to fetch data from the npm API (with up to date TypeScript types)
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @nodesecure/npm-registry-sdk
# or
$ yarn add @nodesecure/npm-registry-sdkimport * as Npm from "@nodesecure/npm-registry-sdk";
const packument: Npm.Packument = await Npm.packument("express");
console.log(packument);packument and packumentVersion take an optional payload options which can be used to provide an NPM token.
import * as Npm from "@nodesecure/npm-registry-sdk";
const user: NpmUserProfile = await Npm.user("test-user");
console.log(user);user takes an optional payload pagination which can be used to set page number and page size to be used for paginated properties of the user like pacakges.
interface LoadRegistryMixins {
spawn?: typeof spawnSync;
}
interface DefaultRegistryApiOptions {
token?: string;
}getNpmRegistryURL(): string
getLocalRegistryURL(): string
setLocalRegistryURL(value: string | URL): string
loadRegistryURLFromLocalSystem(mixins: LoadRegistryMixins = {}): string
For complete details on each API, refer the following documents:
Thanks goes to these wonderful people (emoji key):
MIT
