{"library":"npm-api","title":"NPM API Client","description":"This Node.js library, `npm-api` (current stable version 1.0.1), provides a programmatic interface for interacting with the public NPM registry API, primarily through its CouchDB views. It allows developers to fetch package metadata, retrieve maintainer information, and query registry data using its `NpmApi` client and associated `Repo` and `Maintainer` models. The library simplifies what would otherwise be direct HTTP requests to the registry, offering methods to get package details, specific versions, and a maintainer's list of repositories. While it once served as a convenient wrapper, the package has not received updates in approximately five years, indicating it is likely abandoned and should be used with caution, particularly for new projects requiring active support or modern features.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install npm-api"],"cli":null},"imports":["const NpmApi = require('npm-api');","const Repo = require('npm-api/lib/models/repo');","const Maintainer = require('npm-api/lib/models/maintainer');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const NpmApi = require('npm-api');\n\nasync function getNpmInfo() {\n  const npm = new NpmApi();\n\n  // Get info for a specific repository via the NpmApi instance\n  console.log('--- Repository Info ---');\n  const repo = npm.repo('express');\n  try {\n    const pkg = await repo.package();\n    console.log(`Package: ${pkg.name}@${pkg.version}`);\n    console.log(`Description: ${pkg.description}`);\n    console.log(`Maintainers: ${pkg.maintainers.map(m => m.name).join(', ')}`);\n  } catch (err) {\n    console.error(`Error fetching express package: ${err.message}`);\n  }\n\n  // Get info for a specific maintainer via the NpmApi instance\n  console.log('\\n--- Maintainer Info ---');\n  const maintainer = npm.maintainer('ljharb');\n  try {\n    const repos = await maintainer.repos();\n    console.log(`Maintainer ljharb manages ${repos.length} repositories.`);\n    console.log('Some of their repos:');\n    repos.slice(0, 3).forEach(r => console.log(`- ${r}`));\n  } catch (err) {\n    console.error(`Error fetching maintainer repos: ${err.message}`);\n  }\n}\n\ngetNpmInfo();","lang":"javascript","description":"Demonstrates fetching package details for 'express' and listing repositories for 'ljharb' using the `NpmApi` client.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}