mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat!: deprecate createBrowserFetcher in favor of BrowserFetcher (#9079)
This PR deprecates the `createBrowserFetcher` API and requests users to import the `BrowserFetcher` directly. Fixed: #8999
This commit is contained in:
21
docs/api/puppeteer.browserfetcher._constructor_.md
Normal file
21
docs/api/puppeteer.browserfetcher._constructor_.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.(constructor)
|
||||
---
|
||||
|
||||
# BrowserFetcher.(constructor)
|
||||
|
||||
Constructs a browser fetcher for the given options.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
constructor(options?: BrowserFetcherOptions);
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------------------------------------------------------------- | ----------------- |
|
||||
| options | [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | <i>(Optional)</i> |
|
||||
@@ -14,23 +14,25 @@ export declare class BrowserFetcher
|
||||
|
||||
## Remarks
|
||||
|
||||
BrowserFetcher operates on revision strings that specify a precise version of Chromium, e.g. `"533271"`. Revision strings can be obtained from [omahaproxy.appspot.com](http://omahaproxy.appspot.com/). In the Firefox case, BrowserFetcher downloads Firefox Nightly and operates on version numbers such as `"75"`.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BrowserFetcher` class.
|
||||
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:
|
||||
|
||||
```ts
|
||||
const browserFetcher = puppeteer.createBrowserFetcher();
|
||||
const browserFetcher = new BrowserFetcher();
|
||||
const revisionInfo = await browserFetcher.download('533271');
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: revisionInfo.executablePath,
|
||||
});
|
||||
```
|
||||
|
||||
**NOTE** BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --------------------------------------------------------------------- | --------- | --------------------------------------------------- |
|
||||
| [(constructor)(options)](./puppeteer.browserfetcher._constructor_.md) | | Constructs a browser fetcher for the given options. |
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ sidebar_label: BrowserFetcherOptions.host
|
||||
|
||||
# BrowserFetcherOptions.host property
|
||||
|
||||
Determines the host that will be used for downloading.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
|
||||
@@ -12,9 +12,9 @@ export interface BrowserFetcherOptions
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ---------------------------------------------------------- | --------- | ----------------------------------- | ----------------- |
|
||||
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> |
|
||||
| [path?](./puppeteer.browserfetcheroptions.path.md) | | string | <i>(Optional)</i> |
|
||||
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> |
|
||||
| [product?](./puppeteer.browserfetcheroptions.product.md) | | string | <i>(Optional)</i> |
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ---------------------------------------------------------- | --------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
||||
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> Determines the host that will be used for downloading. |
|
||||
| [path?](./puppeteer.browserfetcheroptions.path.md) | | string | <i>(Optional)</i> Determines the path to download browsers to. |
|
||||
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> Determines which platform the browser will be suited for. |
|
||||
| [product?](./puppeteer.browserfetcheroptions.product.md) | | 'chrome' \| 'firefox' | <i>(Optional)</i> Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for. |
|
||||
|
||||
@@ -4,6 +4,8 @@ sidebar_label: BrowserFetcherOptions.path
|
||||
|
||||
# BrowserFetcherOptions.path property
|
||||
|
||||
Determines the path to download browsers to.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
|
||||
@@ -4,6 +4,8 @@ sidebar_label: BrowserFetcherOptions.platform
|
||||
|
||||
# BrowserFetcherOptions.platform property
|
||||
|
||||
Determines which platform the browser will be suited for.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
|
||||
@@ -4,10 +4,12 @@ sidebar_label: BrowserFetcherOptions.product
|
||||
|
||||
# BrowserFetcherOptions.product property
|
||||
|
||||
Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherOptions {
|
||||
product?: string;
|
||||
product?: 'chrome' | 'firefox';
|
||||
}
|
||||
```
|
||||
|
||||
@@ -4,6 +4,10 @@ sidebar_label: createBrowserFetcher
|
||||
|
||||
# createBrowserFetcher variable
|
||||
|
||||
> Warning: This API is now obsolete.
|
||||
>
|
||||
> Import [BrowserFetcher](./puppeteer.browserfetcher.md) directly and use the constructor.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
|
||||
@@ -4,6 +4,10 @@ sidebar_label: PuppeteerNode.createBrowserFetcher
|
||||
|
||||
# PuppeteerNode.createBrowserFetcher() method
|
||||
|
||||
> Warning: This API is now obsolete.
|
||||
>
|
||||
> Import [BrowserFetcher](./puppeteer.browserfetcher.md) directly and use the constructor.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
|
||||
Reference in New Issue
Block a user