Principle:Puppeteer Puppeteer Platform Detection
| Knowledge Sources | |
|---|---|
| Domains | Browser_Management, System_Detection |
| Last Updated | 2026-02-11 23:00 GMT |
Overview
A technique that auto-detects the operating system and CPU architecture to determine the correct browser binary variant to download.
Description
Platform Detection is the first step in browser installation. Different operating systems and architectures require different browser binaries. The detection maps the Node.js runtime environment to a platform identifier used for download URL construction and executable path resolution.
Supported platforms: Linux (x64), Linux (ARM64), macOS (x64), macOS (ARM64/Apple Silicon), Windows (32-bit), Windows (64-bit).
Usage
Use platform detection at the start of any browser installation workflow. It is typically called automatically by the install function but can be used independently to verify platform support.
Theoretical Basis
# Platform detection mapping
os.platform() + os.arch() → BrowserPlatform
'linux' + 'x64' → 'linux'
'linux' + 'arm64' → 'linux_arm'
'darwin' + 'x64' → 'mac'
'darwin' + 'arm64' → 'mac_arm'
'win32' + 'ia32' → 'win32'
'win32' + 'x64' → 'win64'