(options?: EnsureBrowserOptions)
| 374 | } |
| 375 | |
| 376 | async function downloadBrowser(options?: EnsureBrowserOptions): Promise<BrowserResult> { |
| 377 | if (isLinuxArm()) { |
| 378 | return ensureLinuxArmBrowser(options); |
| 379 | } |
| 380 | |
| 381 | const { Browser, detectBrowserPlatform, install } = await loadPuppeteerBrowsers(); |
| 382 | |
| 383 | const platform = detectBrowserPlatform(); |
| 384 | if (!platform) { |
| 385 | throw new Error(`Unsupported platform: ${process.platform} ${process.arch}`); |
| 386 | } |
| 387 | |
| 388 | const installed = await install({ |
| 389 | cacheDir: CACHE_DIR, |
| 390 | browser: Browser.CHROMEHEADLESSSHELL, |
| 391 | buildId: CHROME_VERSION, |
| 392 | platform, |
| 393 | downloadProgressCallback: options?.onProgress, |
| 394 | }); |
| 395 | |
| 396 | return { executablePath: installed.executablePath, source: "download" }; |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * Remove the cached Chrome download directory. |
no test coverage detected