/npm-registry-sdk

Node.js SDK to fetch data from the npm API.

Primary LanguageTypeScriptMIT LicenseMIT

npm-registry-sdk

version Maintenance OpenSSF Scorecard mit build

Node.js SDK to fetch data from the npm API.

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 Registry from "@nodesecure/npm-registry-sdk";

API

getNpmRegistryURL(): string

getLocalRegistryURL(): string

setLocalRegistryURL(value: string | URL): string

loadRegistryURLFromLocalSystem(): string

metadata(): Promise<NpmRegistryMetadata>

interface NpmRegistryMetadata {
  db_name: string;
  doc_count: number;
  doc_del_count: number;
  update_seq: number;
  purge_seq: number;
  compact_running: boolean;
  disk_size: number;
  data_size: number;
  instance_start_time: string;
  disk_format_version: number;
  committed_update_seq: number;
}

packument(name: string, options?: PackumentOptions): Promise<npm.Packument>

interface PackumentOptions {
  token: string;
}

packumentVersion(name: string, version: string, options?: packumentOptions): Promise<npm.PackumentVersion>

downloads(pkgName: string, period: Period = "last-week"): Promise< NpmPackageDownload >

interface NpmPackageDownload {
  downloads: number;
  start: string;
  end: string;
  package: string;
}

Contributors ✨

All Contributors

Thanks goes to these wonderful people (emoji key):


Gentilhomme

💻 📖 👀 🛡️ 🐛

Quentin Lepateley

💻 📖 👀

Nicolas Hallaert

📖

tekeuange23

💻

Tony Gorez

💻

License

MIT