puppeteer/docs/api/puppeteer.browserfetcher.md
jrandolf ec201744f0
feat: use configuration files (#9140)
This PR adds configurations files to `puppeteer`'s methods for
configuration. Under the hood, `puppeteer` relies on
https://www.npmjs.com/package/cosmiconfig which resolves several formats
of configuration:

- a `puppeteer` property in package.json
- a `.puppeteerrc` file in JSON or YAML format
- a `.puppeteerrc.json`, `.puppeteerrc.yaml`, `.puppeteerrc.yml`,
`.puppeteerrc.js`, or `.puppeteerrc.cjs` file
- a `puppeteer.config.js` or `puppeteer.config.cjs` CommonJS module
exporting an object

Documentation will be added later.

Fixed: #9128
2022-10-21 15:09:21 +02:00

2.7 KiB

sidebar_label
BrowserFetcher

BrowserFetcher class

BrowserFetcher can download and manage different versions of Chromium and Firefox.

Signature:

export declare class BrowserFetcher

Remarks

BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.

Example

An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:

const browserFetcher = new BrowserFetcher({path: 'path/to/download/folder'});
const revisionInfo = await browserFetcher.download('533271');
const browser = await puppeteer.launch({
  executablePath: revisionInfo.executablePath,
});

Constructors

Constructor Modifiers Description
(constructor)(options) Constructs a browser fetcher for the given options.

Methods

Method Modifiers Description
canDownload(revision) Initiates a HEAD request to check if the revision is available.
download(revision, progressCallback) Initiates a GET request to download the revision from the host.
host()
localRevisions()
platform()
product()
remove(revision)
revisionInfo(revision)