InstallOptions 接口
🌐 InstallOptions interface
语法
🌐 Signature
export interface InstallOptions
属性
🌐 Properties
|
属性 🌐 Property |
修饰符 🌐 Modifiers |
类型 🌐 Type |
描述 🌐 Description |
默认 🌐 Default |
|---|---|---|---|---|
|
baseUrl |
|
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 |
|
string |
提供的 🌐 An alias for the provided | |
|
cacheDir |
string |
确定下载浏览器的路径。 🌐 Determines the path to download browsers to. | ||
|
downloadProgressCallback |
|
'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. | |
|
expectedHash |
|
string |
下载的浏览器归档文件的预期 SHA-256 校验和(小写十六进制)。如果提供,当下载的文件不匹配时安装将失败。如果省略,则下载将继续进行而不进行完整性验证。 🌐 Expected SHA-256 checksum (lowercase hex) of the downloaded browser archive. If provided, installation will fail when the downloaded file does not match. If omitted, the download proceeds without integrity verification. | |
|
installDeps |
|
boolean |
是否尝试安装浏览器所需的系统级依赖。 🌐 Whether to attempt to install system-level dependencies required for the browser. 仅支持在 Debian 或 Ubuntu 上的 Chrome。运行 🌐 Only supported for Chrome on Debian or Ubuntu. Requires system-level privileges to run |
|
|
logger |
|
伐木工 🌐 Logger | ||
|
platform |
|
确定浏览器适合哪个平台。 🌐 Determines which platform the browser will be suited for. |
自动检测。 | |
|
providers |
|
[浏览器提供商](./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 仅测试并保证与默认二进制文件的兼容性。 | |
|
unpack |
|
boolean |
是否解压并安装浏览器存档。 🌐 Whether to unpack and install browser archives. |
|