Add environment variable to skip download (#606)

This patch:
- starts skipping chromium download if `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` env variable is set
- adds description of support env variables to the `docs/api.md`.

References #603
This commit is contained in:
Andrey Lushnikov 2017-08-30 21:40:15 -07:00 committed by GitHub
parent 3365562b2b
commit 9d7929cd36
2 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@
<!-- toc -->
- [Puppeteer](#puppeteer)
* [Environment Variables](#environment-variables)
* [class: Puppeteer](#class-puppeteer)
+ [puppeteer.connect(options)](#puppeteerconnectoptions)
+ [puppeteer.launch([options])](#puppeteerlaunchoptions)
@ -137,6 +138,12 @@
Puppeteer is a Node library which provides a high-level API to control Chromium over the DevTools Protocol.
### Environment Variables
Puppeteer looks for certain environment variables to aid its operations:
- `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` - defines HTTP proxy settings that are used to download and run Chromium.
- `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` - do not download bundled Chromium during installation step.
### class: Puppeteer

View File

@ -14,6 +14,11 @@
* limitations under the License.
*/
if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) {
console.log('**INFO** Skipping Chromium download. "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" environment variable was found.');
return;
}
const Downloader = require('./utils/ChromiumDownloader');
const platform = Downloader.currentPlatform();
const revision = require('./package').puppeteer.chromium_revision;