Skip to main content

mirror

Manage browser download mirror sources.

Usage

pbvm mirror [-s <source>] [-i]

Options

OptionShortDescription
--source-sMirror source name, e.g. npmmirror; interactive selection if not specified
--init-iCreate a mirror config file in the current directory (project-level); defaults to global config

How it works

pbvm mirror controls the download mirror by writing a .browsermr configuration file. The MirrorProvider intercepts @puppeteer/browsers download requests and replaces the original URL with the mirror address.

Mirror templates use the following variables for URL substitution:

VariableDescription
<browser>Browser name (chrome / chromium / firefox)
<buildId>Version number without the channel prefix
<channelId>Full channel + version (Firefox only)
<platform>Platform identifier
<lang>Language (Firefox only, default zh-CN)
<ext>File extension
<suffix>Browser-specific suffix

Use --rule (on create / search commands) to pass custom params that override identically-named variables in the template.

Config file hierarchy

  • Project-level (-i): Creates .browsermr in the current directory; applies only to the current project
  • Global (default): Writes to the pbvm config directory; applies to all projects globally

create and search commands prefer the project-level .browsermr; fall back to the global config if none is found.

Examples

Interactive mode

Run without arguments and follow the prompts:

pbvm mirror

Interactive options:

  1. Use npmmirror — enable the npmmirror mirror source
  2. Remove the mirror — disable mirroring (delete .browsermr)

CLI mode

# Enable the global npmmirror mirror
pbvm mirror -s npmmirror

# Enable the mirror for the current project only
pbvm mirror -s npmmirror -i

# Disable the global mirror
pbvm mirror
# Choose "Remove the mirror" interactively, or run without specifying a source

Even without a global or project-level .browsermr, you can temporarily specify a mirror on create or search:

# Temporarily use a mirror for search
pbvm search -b chrome -i 134.0.6998.35 -m ./path/to/.browsermr

# Temporarily use a mirror for install with custom template vars
pbvm create -b firefox -i stable_136.0.0 -m ./custom.mr -r "lang=en-US&ext=tar.bz2"