Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Puppeteer Puppeteer DefaultProvider

From Leeroopedia
Property Value
sources packages/browsers/src/DefaultProvider.ts
domains Browser Management, Download Provider
last_updated 2026-02-12 00:00 GMT

Overview

Description

The DefaultProvider class is the standard BrowserProvider implementation used by Puppeteer. It implements the BrowserProvider interface and provides download URL resolution and executable path computation using the built-in browser data modules (Chrome, Firefox, etc.).

The class delegates download URL construction to the downloadUrls lookup table and executable path resolution to the executablePathByBrowser lookup table, both sourced from the centralized browser-data module. It accepts an optional baseUrl constructor parameter that overrides the default download source URLs. The provider declares support for all browsers through its supports() method, which always returns true.

Usage

The DefaultProvider is the standard provider passed to the browser installation and download pipeline. Users who wish to use alternative download sources (e.g., corporate mirrors or Electron ChromeDriver builds) can implement the BrowserProvider interface instead.

Code Reference

Source Location

packages/browsers/src/DefaultProvider.ts

Signature

export class DefaultProvider implements BrowserProvider {
  constructor(baseUrl?: string);

  supports(_options: DownloadOptions): boolean;
  getDownloadUrl(options: DownloadOptions): URL;
  getExecutablePath(options: {
    browser: Browser;
    buildId: string;
    platform: BrowserPlatform;
  }): string;
  getName(): string;
}

Import

import {DefaultProvider} from '@puppeteer/browsers';

I/O Contract

Constructor

Parameter Type Description
baseUrl string (optional) Custom base URL to override default download sources

Methods

Method Parameters Return Type Description
supports DownloadOptions boolean Always returns true; the default provider supports all browsers
getDownloadUrl DownloadOptions URL Returns the download URL for the specified browser, platform, and build ID
getExecutablePath {browser, buildId, platform} string Returns the relative executable path within the extracted archive
getName none string Returns 'DefaultProvider'

Usage Examples

import {DefaultProvider, Browser, BrowserPlatform} from '@puppeteer/browsers';

// Use with default download sources
const provider = new DefaultProvider();

// Use with a custom mirror
const mirrorProvider = new DefaultProvider('https://my-mirror.example.com/browsers');

// Check if the provider supports a download
const supported = provider.supports({
  browser: Browser.CHROME,
  platform: BrowserPlatform.LINUX,
  buildId: '131.0.6778.109',
});
// => true

// Get the download URL
const url = provider.getDownloadUrl({
  browser: Browser.CHROME,
  platform: BrowserPlatform.LINUX,
  buildId: '131.0.6778.109',
});

// Get the executable path
const execPath = provider.getExecutablePath({
  browser: Browser.CHROME,
  platform: BrowserPlatform.LINUX,
  buildId: '131.0.6778.109',
});

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment