@nodesecure/npm-registry-sdk
v4.5.2
Published
Node.js SDK to fetch data from the npm API.
Readme
Node.js SDK to fetch data from the npm API (with up to date TypeScript types)
Getting Started
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-sdkUsage example
import * 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.
API Documentaion
Registry Modules
Types
interface LoadRegistryMixins {
spawn?: typeof spawnSync;
}
interface DefaultRegistryApiOptions {
token?: string;
}Functions
getNpmRegistryURL(): string
getLocalRegistryURL(): string
setLocalRegistryURL(value: string | URL): string
loadRegistryURLFromLocalSystem(mixins: LoadRegistryMixins = {}): stringFor complete details on each API, refer the following documents:
Contributors ✨
Thanks goes to these wonderful people (emoji key):
License
MIT
