NPM.RegistryMirror (NPM v0.6.0)

Copy Markdown View Source

Support for registry mirror URLs and fallback.

Configure mirrors for faster downloads from geographically closer servers, with automatic fallback to the primary registry.

Summary

Functions

Get a specific mirror URL by name.

Check if a URL is a known mirror.

List known mirror names and URLs.

Get the configured mirror URL, or the default registry.

Rewrite a tarball URL to use a mirror.

Functions

get_mirror(name)

@spec get_mirror(String.t()) :: String.t() | nil

Get a specific mirror URL by name.

known_mirror?(url)

@spec known_mirror?(String.t()) :: boolean()

Check if a URL is a known mirror.

known_mirrors()

@spec known_mirrors() :: %{required(String.t()) => String.t()}

List known mirror names and URLs.

mirror_url()

@spec mirror_url() :: String.t()

Get the configured mirror URL, or the default registry.

rewrite_tarball_url(tarball_url, mirror_url)

@spec rewrite_tarball_url(String.t(), String.t()) :: String.t()

Rewrite a tarball URL to use a mirror.

Replaces the registry hostname with the mirror hostname.