Get npm registry information including URL, auth token, and authorization header from a given scope or default. Version 1.0.0. This is a small utility that combines registry-auth-token and registry-url to provide a unified API. It is useful for tooling that needs to interact with private npm registries. The package is mature and stable, with no recent updates. It supports both default registry and scoped registries. Alternative: directly using registry-auth-token and registry-url separately.
npm install registry-infoVerified import paths — ran on the pinned version, not inferred.
Demonstrates default import and usage with and without scope.
Check if authToken or authorization exist before using in headers: const { authorization } = registryInfo(); if (authorization) { headers['Authorization'] = authorization; }Pin versions in package.json: "registry-auth-token": "3.x", "registry-url": "5.x"
Set npm token: npm config set //registry.npmjs.org/:_authToken=YOUR_TOKEN
Use `import registryInfo from 'registry-info'` instead of `import { registryInfo } from 'registry-info'`.Run `npm install registry-info --save` and ensure the package is in your dependencies.
Use `const registryInfo = require('registry-info').default;` or better switch to ES imports.