Socket
Book a DemoInstallSign in
Socket

registry-url

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

registry-url

Get the set npm registry URL

latest
Source
npmnpm
Version
7.2.0
Version published
Weekly downloads
21M
105.72%
Maintainers
1
Weekly downloads
 
Created
Source

registry-url

Get the set npm registry URL

It's usually https://registry.npmjs.org/, but it's configurable.

Use this if you do anything with the npm registry as users will expect it to use their configured registry.

Install

npm install registry-url

Usage

# .npmrc
registry = 'https://custom-registry.com/'
import registryUrl, {defaultUrl} from 'registry-url';

console.log(registryUrl());
//=> 'https://custom-registry.com/'

console.log(defaultUrl);
//=> 'https://registry.npmjs.org/'

It can also retrieve the registry URL associated with an npm scope.

# .npmrc
@myco:registry = 'https://custom-registry.com/'
import registryUrl from 'registry-url';

console.log(registryUrl('@myco'));
//=> 'https://custom-registry.com/'

If the provided scope is not in the user's .npmrc file, then registry-url will check for the existence of registry, or if that's not set, fallback to the default npm registry.

Keywords

npm

FAQs

Package last updated on 15 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts