npm.io
4.5.2 • Published 6 months ago

@nodesecure/npm-registry-sdk

Licence
MIT
Version
4.5.2
Deps
2
Size
46 kB
Vulns
0
Weekly
0
Stars
10

@nodesecure/npm-registry-sdk

npm version maintenance license ossf scorecard github ci workflow

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-sdk

Usage 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 = {}): string

For complete details on each API, refer the following documents:

Contributors

All Contributors

Thanks goes to these wonderful people (emoji key):

Gentilhomme
Gentilhomme

Quentin Lepateley
Quentin Lepateley

Nicolas Hallaert
Nicolas Hallaert

tekeuange23
tekeuange23

Tony Gorez
Tony Gorez

hiroki osame
hiroki osame

Kouadio Fabrice Nguessan
Kouadio Fabrice Nguessan

PierreDemailly
PierreDemailly

Kishore
Kishore

Clement Gombauld
Clement Gombauld

Mohd Anas
Mohd Anas

License

MIT