{"id":19041827,"url":"https://github.com/invertase/puppeteer-pool","last_synced_at":"2025-09-23T19:25:57.437Z","repository":{"id":57119055,"uuid":"163682701","full_name":"invertase/puppeteer-pool","owner":"invertase","description":"Flexible Puppeteer Browser instance resource pooling.","archived":false,"fork":false,"pushed_at":"2019-01-22T19:41:44.000Z","size":17,"stargazers_count":31,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T21:49:12.915Z","etag":null,"topics":["nodejs","pooling","puppeteer"],"latest_commit_sha":null,"homepage":"https://invertase.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/invertase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-31T16:23:26.000Z","updated_at":"2025-04-11T19:19:19.000Z","dependencies_parsed_at":"2022-08-22T21:30:51.901Z","dependency_job_id":null,"html_url":"https://github.com/invertase/puppeteer-pool","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Fpuppeteer-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Fpuppeteer-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Fpuppeteer-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invertase%2Fpuppeteer-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/invertase","download_url":"https://codeload.github.com/invertase/puppeteer-pool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522294,"owners_count":21444510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","pooling","puppeteer"],"created_at":"2024-11-08T22:32:32.303Z","updated_at":"2025-09-23T19:25:52.414Z","avatar_url":"https://github.com/invertase.png","language":"JavaScript","funding_links":["https://opencollective.com/react-native-firebase"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://invertase.io\"\u003e\n    \u003cimg src=\"https://static.invertase.io/assets/invertase-logo-small.png\"\u003e\u003cbr/\u003e\n  \u003c/a\u003e\n  \u003ch2 align=\"center\"\u003ePuppeteer Pool\u003c/h2\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@invertase/puppeteer-pool\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/@invertase/puppeteer-pool.svg?style=flat-square\" alt=\"NPM downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@invertase/puppeteer-pool\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@invertase/puppeteer-pool.svg?style=flat-square\" alt=\"NPM version\"\u003e\u003c/a\u003e\n  \u003ca href=\"/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/@invertase/puppeteer-pool.svg?style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://discord.gg/C9aK28N\"\u003e\u003cimg src=\"https://img.shields.io/discord/295953187817521152.svg?logo=discord\u0026style=flat-square\u0026colorA=7289da\u0026label=discord\" alt=\"Chat\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://twitter.com/invertaseio\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/invertaseio.svg?style=social\u0026label=Follow\" alt=\"Follow on Twitter\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n----\n\n[Puppeteer](https://github.com/GoogleChrome/puppeteer) [browser](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-browser) instance pooling via [generic-pool](https://github.com/coopernurse/node-pool)\n\n## Installation\n\n```bash\n# NPM:\nnpm i @invertase/puppeteer-pool\n# YARN:\nyarn add @invertase/puppeteer-pool\n```\n\n## Usage\n\n### Import\n\n```js\nconst createPuppeteerPool = require('@invertase/puppeteer-pool');\n```\n\n### Create a pool\n\n```js\nconst pool = createPuppeteerPool({\n  min: 2,\n  max: 10,\n  puppeteerLaunchArgs: [{ headless: false }],\n});\n```\n\n#### Options\n\n- `validate`: A function to validate an instance prior to use, must return a promise that resolves `true` or `false`\n- `puppeteerLaunchArgs`: Array of arguments to pass to `puppeteer.launch` when instances are created\n\n**Options provided by [generic-pool](https://github.com/coopernurse/node-pool/blob/master/README.md#documentation):**\n- `max`: maximum number of resources to create at any given time. (default=1)\n- `min`: minimum number of resources to keep in pool at any given time. If this is set \u003e= max, the pool will silently set the min to equal `max`. (default=0)\n- `maxWaitingClients`: maximum number of queued requests allowed, additional `acquire` calls will be callback with an `err` in a future cycle of the event loop.\n- `testOnBorrow`: `boolean`: should the pool validate resources before giving them to clients.\n- `acquireTimeoutMillis`: max milliseconds an `acquire` call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.\n- `fifo` : if true the oldest resources will be first to be allocated. If false the most recently released resources will be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. `boolean`, (default true)\n- `priorityRange`: int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources are available.\n- `autostart`: boolean, should the pool start creating resources, initialize the evictor, etc once the constructor is called. If false, the pool can be started by calling `pool.start`, otherwise the first call to `acquire` will start the pool. (default true)\n- `evictionRunIntervalMillis`: How often to run eviction checks. Default: 0 (does not run).\n- `numTestsPerEvictionRun`: Number of resources to check each eviction run.  Default: 3.\n- `softIdleTimeoutMillis`: amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any), with the extra condition that at least \"min idle\" object instances remain in the pool. Default -1 (nothing can get evicted)\n- `idleTimeoutMillis`: the minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due to idle time. Supersedes `softIdleTimeoutMillis` Default: 30000\n- `Promise`: Promise lib, a Promises/A+ implementation that the pool should use. Defaults to whatever `global.Promise` is (usually native promises).\n\n### Acquire a [browser](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-browser) instance\n\n```js\nconst browserInstance = await pool.acquire();\n```\n\n### Release a [browser](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-browser) instance\n\n```js\nconst browserInstance = await pool.acquire();\n// do something with your instance,\n// when you're finished with the instance; call release:\nawait pool.release(browserInstance);\n```\n\n### Drain and clear the pool\n\n```js\nawait pool.drain();\nawait pool.clear();\n```\n\n\n## License\n\nSee [LICENSE](/LICENSE)\n\n---\n\nBuilt and maintained with 💛 by [Invertase](https://invertase.io).\n\n- [💼 Hire Us](https://invertase.io/hire-us)\n- [☕️ Sponsor Us](https://opencollective.com/react-native-firebase)\n- [👩‍💻 Work With Us](https://invertase.io/jobs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvertase%2Fpuppeteer-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finvertase%2Fpuppeteer-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvertase%2Fpuppeteer-pool/lists"}