Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@invertase/puppeteer-pool
Advanced tools
Puppeteer browser instance pooling via generic-pool
# NPM:
npm i @invertase/puppeteer-pool
# YARN:
yarn add @invertase/puppeteer-pool
const createPuppeteerPool = require('@invertase/puppeteer-pool');
const pool = createPuppeteerPool({
min: 2,
max: 10,
puppeteerLaunchArgs: [{ headless: false }],
});
validate
: A function to validate an instance prior to use, must return a promise that resolves true
or false
puppeteerLaunchArgs
: Array of arguments to pass to puppeteer.launch
when instances are createdOptions provided by generic-pool:
max
: maximum number of resources to create at any given time. (default=1)min
: minimum number of resources to keep in pool at any given time. If this is set >= max, the pool will silently set the min to equal max
. (default=0)maxWaitingClients
: maximum number of queued requests allowed, additional acquire
calls will be callback with an err
in a future cycle of the event loop.testOnBorrow
: boolean
: should the pool validate resources before giving them to clients.acquireTimeoutMillis
: max milliseconds an acquire
call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.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)priorityRange
: int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources are available.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)evictionRunIntervalMillis
: How often to run eviction checks. Default: 0 (does not run).numTestsPerEvictionRun
: Number of resources to check each eviction run. Default: 3.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)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: 30000Promise
: Promise lib, a Promises/A+ implementation that the pool should use. Defaults to whatever global.Promise
is (usually native promises).const browserInstance = await pool.acquire();
const browserInstance = await pool.acquire();
// do something with your instance,
// when you're finished with the instance; call release:
await pool.release(browserInstance);
await pool.drain();
await pool.clear();
See LICENSE
FAQs
Pool Puppeteer browser instances for fast access.
We found that @invertase/puppeteer-pool demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.