Skip to main content
Version: 24.38.0

InstallOptions 接口

🌐 InstallOptions interface

语法

🌐 Signature

export interface InstallOptions

属性

🌐 Properties

属性

🌐 Property

修饰符

🌐 Modifiers

类型

🌐 Type

描述

🌐 Description

默认

🌐 Default

baseUrl

optional

string

确定将用于下载的主机。

🌐 Determines the host that will be used for downloading.

任何一个

🌐 Either

browser

浏览器

确定要安装的浏览器。

🌐 Determines which browser to install.

buildId

string

确定要下载哪个 buildId。BuildId 应该唯一标识二进制文件,并且它们用于缓存。

🌐 Determines which buildId to download. BuildId should uniquely identify binaries and they are used for caching.

buildIdAlias

optional

string

提供的 buildId 的别名。它将用于维护本地元数据,以支持 launch 命令中的别名。

🌐 An alias for the provided buildId. It will be used to maintain local metadata to support aliases in the launch command.

cacheDir

string

确定下载浏览器的路径。

🌐 Determines the path to download browsers to.

downloadProgressCallback

optional

'default' | ((downloadedBytes: number, totalBytes: number) => void)

提供有关下载进度的信息。如果设置为“默认”,将使用实现进度条的默认回调。

🌐 Provides information about the progress of the download. If set to 'default', the default callback implementing a progress bar will be used.

installDeps

optional

boolean

是否尝试安装浏览器所需的系统级依赖。

🌐 Whether to attempt to install system-level dependencies required for the browser.

仅支持在 Debian 或 Ubuntu 上的 Chrome。运行 apt-get 需要系统级权限。

🌐 Only supported for Chrome on Debian or Ubuntu. Requires system-level privileges to run apt-get.

false

platform

optional

浏览器平台

确定浏览器适合哪个平台。

🌐 Determines which platform the browser will be suited for.

自动检测。

providers

optional

[浏览器提供商](./browsers.browserprovider.md)[]

用于备用下载源的自定义提供器实现。

🌐 Custom provider implementation for alternative download sources.

如果未提供,则使用默认提供者。可以串联多个提供者——它们将按顺序尝试。默认提供者会自动作为最终备用项添加。

🌐 If not provided, uses the default provider. Multiple providers can be chained - they will be tried in order. The default provider is automatically added as the final fallback.

⚠️ 重要:Puppeteer 官方不支持自定义提供器。

通过使用自定义提供者,你需承担以下全部责任:

🌐 By using custom providers, you accept full responsibility for:

  • 版本兼容性:不同平台可能收到不同的二进制版本 - 归档兼容性:二进制结构必须与 Puppeteer 的预期相匹配 - 功能集成:浏览器启动及其他 Puppeteer 功能可能无法使用 - 测试:你必须验证下载的二进制文件是否能与 Puppeteer 一起使用

Puppeteer 仅测试并保证与默认二进制文件的兼容性。

unpack

optional

boolean

是否解压并安装浏览器存档。

🌐 Whether to unpack and install browser archives.

true