Implementation:Puppeteer Puppeteer Browsers Main
Appearance
| Property | Value |
|---|---|
| sources | packages/browsers/src/main.ts |
| domains | Package Entry Point, Public API Surface |
| last_updated | 2026-02-12 00:00 GMT |
Overview
Description
The Browsers Main module is the public entry point for the @puppeteer/browsers package. It serves as a barrel export file that aggregates and re-exports the complete public API surface of the package from its various internal modules.
The module re-exports functionality from the following internal modules:
- launch.js -- Browser launching (
launch,computeExecutablePath,computeSystemExecutablePath,Process,TimeoutError, WebSocket endpoint regex patterns) - install.js -- Browser installation (
install,uninstall,getInstalledBrowsers,canDownload,getDownloadUrl,makeProgressCallback) - detectPlatform.js -- Platform detection (
detectBrowserPlatform) - browser-data/browser-data.js -- Browser data and types (
resolveBuildId,Browser,BrowserPlatform,ChromeReleaseChannel,createProfile,getVersionComparator,resolveDefaultUserDataDir) - CLI.js -- Command-line interface (
CLI) - Cache.js -- Cache management (
Cache,InstalledBrowser) - browser-data/types.js -- Browser tag types (
BrowserTag) - DefaultProvider.js -- Default download provider (
DefaultProvider) - provider.js -- Provider interface and utilities (
BrowserProvider,buildArchiveFilename)
Usage
This module is the sole import target for consumers of the @puppeteer/browsers package. All public types, classes, functions, and enums are accessible through this entry point.
Code Reference
Source Location
packages/browsers/src/main.ts
Signature
// Type exports
export type {LaunchOptions, ComputeExecutablePathOptions as Options, SystemOptions} from './launch.js';
export type {InstallOptions, GetInstalledBrowsersOptions, UninstallOptions} from './install.js';
export type {ProfileOptions} from './browser-data/browser-data.js';
export type {BrowserProvider, DownloadOptions} from './provider.js';
export type {Metadata, ComputeExecutablePathOptions} from './Cache.js';
// Value exports
export {launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process} from './launch.js';
export {install, makeProgressCallback, getInstalledBrowsers, canDownload, uninstall, getDownloadUrl} from './install.js';
export {detectBrowserPlatform} from './detectPlatform.js';
export {resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, getVersionComparator, resolveDefaultUserDataDir} from './browser-data/browser-data.js';
export {CLI} from './CLI.js';
export {Cache, InstalledBrowser} from './Cache.js';
export {BrowserTag} from './browser-data/types.js';
export {DefaultProvider} from './DefaultProvider.js';
export {buildArchiveFilename} from './provider.js';
Import
import {
install,
launch,
Browser,
BrowserPlatform,
detectBrowserPlatform,
resolveBuildId,
Cache,
CLI,
} from '@puppeteer/browsers';
I/O Contract
Exported Categories
| Category | Exports | Description |
|---|---|---|
| Browser Launching | launch, computeExecutablePath, computeSystemExecutablePath, Process, TimeoutError |
Functions and classes for launching and managing browser processes |
| Browser Installation | install, uninstall, getInstalledBrowsers, canDownload, getDownloadUrl, makeProgressCallback |
Functions for downloading, installing, and managing browser binaries |
| Platform Detection | detectBrowserPlatform |
Detects the current OS/architecture combination |
| Browser Data | resolveBuildId, createProfile, getVersionComparator, resolveDefaultUserDataDir |
Version resolution and profile management |
| Enums | Browser, BrowserPlatform, BrowserTag, ChromeReleaseChannel |
Type-safe enumerations for browser identification |
| Cache | Cache, InstalledBrowser |
Cache management for installed browsers |
| CLI | CLI |
Command-line interface class |
| Provider | DefaultProvider, buildArchiveFilename |
Download provider interface and utilities |
| Regex | CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX |
Patterns for extracting WebSocket endpoints from browser output |
Usage Examples
import {
install,
launch,
Browser,
BrowserPlatform,
detectBrowserPlatform,
resolveBuildId,
ChromeReleaseChannel,
} from '@puppeteer/browsers';
// Detect the current platform
const platform = detectBrowserPlatform();
// Resolve the latest stable Chrome build ID
const buildId = await resolveBuildId(Browser.CHROME, platform, 'stable');
// Install Chrome
const installedBrowser = await install({
cacheDir: '/home/user/.cache/puppeteer',
browser: Browser.CHROME,
buildId,
});
// Launch the installed browser
const process = launch({
executablePath: installedBrowser.executablePath,
args: ['--headless'],
});
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment