npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cloudflare/puppeteer

v2.0.1

Published

Puppeteer for Cloudflare Workers

Readme

Puppeteer for Browser Run

This package is a port of Puppeteer modified to be compatible with Cloudflare Workers and Browser Run.

The goals of the port are:

  • Support as much of the existing puppeteer-core library as possible.
  • Minimize the size of the library for Workers developers, since library space is at a premium in Workers projects.
  • Make library use as seamless as possible in Workers.

Installation

npm install @cloudflare/puppeteer

Configuration

@cloudflare/puppeteer needs Node.js compatibility. For a compatibility_date of 2026-08-04 or later, Workers enables Node.js compatibility by default. For an earlier date, you must add the nodejs_compat compatibility flag.

Add a browser binding to your Wrangler configuration:

compatibility_date = "2026-08-04"
browser = { binding = "MYBROWSER" }

If your compatibility_date is earlier than 2026-08-04, also add the nodejs_compat flag:

compatibility_date = "2026-08-03"
compatibility_flags = ["nodejs_compat"]
browser = { binding = "MYBROWSER" }

Do not add the no_nodejs_compat flag. The package does not work without Node.js compatibility.

File options

Options that read or write files use the Workers virtual file system. Examples are page.screenshot({path}), page.pdf({path}), and tracing.start({path}). These options need a compatibility_date of 2025-09-01 or later, or the enable_nodejs_fs_module flag.

Write files to /tmp. Files in /tmp exist only for the current request.

TypeScript

The package types use the Browser Run types of the Workers runtime, for example BrowserRun and BrowserRunAcquireGuardrails. Your project gets these types from wrangler types with Wrangler 4.134.0 or later, or from @cloudflare/workers-types 5.20260917.1 or later.

If your types are older, TypeScript reports Cannot find name 'BrowserRun'. With skipLibCheck, TypeScript does not report an error, but it also does not check these types. To update the types, run:

npx wrangler types

CDP Protocol Support

Browser Run now has full CDP support, so starting with @cloudflare/puppeteer version 1.1.0, the library uses the standard CDP (Chrome DevTools Protocol) internally to communicate with Browser Run.

Everything should work the same way, but if you encounter any issues, please report them. You can also downgrade to a previous puppeteer version by using compatibility_date prior to 2026-03-17 or by adding the no_websocket_standard_binary_type flag:

compatibility_date = "2026-03-16"
# or
compatibility_flags = ["nodejs_compat", "no_websocket_standard_binary_type", ...]

See cloudflare/browser-run#193 and cloudflare/workerd#6442 for details.

Example

import puppeteer from '@cloudflare/puppeteer';

export default {
  async fetch(request, env): Promise<Response> {
    const browser = await puppeteer.launch(env.MYBROWSER);
    const page = await browser.newPage();

    await page.goto('https://example.com');
    const img = await page.screenshot();

    await browser.close();

    return new Response(img, {
      headers: {
        'Content-Type': 'image/png',
      },
    });
  },
} satisfies ExportedHandler<Env>;

Documentation

More information in the Browser Run developer docs.