@fuseble.inc/puppeteer
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Puppeteer Cluster

Example - Starter

import { PuppeteerCluster, wait } from '@fuseble.inc/puppeteer';

const cluster = await PuppeteerCluster.launch('clusterId', {
  concurrency: 'BROWSER',
  maxConcurrency: 2,
});

cluster.task('taskId', async (page, { browser, logger, clusterId, taskId, changeTask }) => {
  await page.goto('https://example.com');
  await page.screenshot({ path: 'example.png' });
  await wait(1000);
});

await cluster.init();
await cluster.close();

Browserless Setting

Docker Setting

docker run -p 3000:3000 \
-e "CONNECTION_TIMEOUT=-1" \
-e "WORKSPACE_DELETE_EXPIRED=true" \
-e "WORKSPACE_EXPIRE_DAYS=7" \
-e "EXIT_ON_HEALTH_FAILURE=true" \
-e "DEFAULT_BLOCK_ADS=true" \
-e "DEFAULT_LAUNCH_ARGS=[\"--window-size=1920,1080\", \"--mute-audio\"]" \
--restart always -d \
--name browserless-3000 browserless/chrome:1-chrome-stable

Readme

Keywords

none

Package Sidebar

Install

npm i @fuseble.inc/puppeteer

Weekly Downloads

0

Version

0.1.4

License

none

Unpacked Size

45.1 kB

Total Files

59

Last publish

Collaborators

  • fuseble