Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

Puppeteer DownloadBehavior: Configure Browser Downloads

Set Puppeteer’s downloadBehavior at launch or connect time to allow page downloads into a chosen directory, or select another supported policy.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To control files downloaded by a page in Puppeteer, set downloadBehavior in the browser’s launch or connect options. Use policy: 'allow' and an absolute downloadPath to permit downloads into a chosen directory. This is a runtime setting for page downloads—not the browser download that may happen while installing Puppeteer.

Configure downloads when launching Puppeteer

The current Puppeteer API reference is for version 25.12.0. Its DownloadBehavior option accepts a policy and, for permitted downloads, a destination path. LaunchOptions extends ConnectOptions, so you can pass the same option when launching a browser or connecting through the common options interface.

As an Amazon Associate I earn from qualifying purchases.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({
  downloadBehavior: {
    policy: 'allow',
    downloadPath: '/absolute/path/to/downloads',
  },
});

try {
  const page = await browser.newPage();
  await page.goto('https://example.com');
  // Trigger a page download here, such as by clicking a download link.
} finally {
  await browser.close();
}

Replace the example path with a directory valid for the machine running Puppeteer. The process must be able to write there. Puppeteer’s API reference says the path is required for allow and allowAndName; it does not establish that Puppeteer creates the directory automatically, so create it yourself if needed. See the DownloadBehavior interface and ConnectOptions reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the right download policy

Policy Effect Path requirement
deny Blocks downloads. Not required by the API definition.
allow Permits downloads using the chosen destination. downloadPath is required.
allowAndName Permits downloads and names files according to their download GUIDs. downloadPath is required.
default Uses the browser’s default behavior, if available. Not required by the API definition.

The API describes allowAndName as naming all files according to their download GUIDs. Choose it only when GUID-based filenames are suitable for your workflow; it is not the option for preserving a human-readable filename as the primary name. Source: Puppeteer DownloadBehavior interface.

Set a custom download directory

Set downloadPath to the path where the browser process should save permitted files. For example, retain policy: 'allow' and replace the sample path:

downloadBehavior: {
  policy: 'allow',
  downloadPath: '/tmp/puppeteer-downloads',
}

Use a path appropriate to the host: an absolute POSIX path on Linux or macOS, or a valid absolute Windows path on Windows. Make sure the directory exists and is writable by the account running Node.js. The API requires the path for allow and allowAndName, but does not specify directory-creation or permission-handling behavior.

Configure behavior when connecting to a browser

downloadBehavior is part of ConnectOptions, which is also the base of LaunchOptions. That lets you supply it in the common options interface when connecting, as well as when launching. The exact connection setup depends on how the browser was started; ensure the installed Puppeteer version and browser/protocol combination support the behavior you need. The reviewed stable API reference does not establish a universal compatibility matrix.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const browser = await puppeteer.connect({
  browserWSEndpoint: 'ws://127.0.0.1:9222/devtools/browser/…',
  downloadBehavior: {
    policy: 'allow',
    downloadPath: '/absolute/path/to/downloads',
  },
});

Use a real WebSocket endpoint for your browser rather than the illustrative endpoint above. See ConnectOptions.

How do I configure browser downloads in Puppeteer?

  1. Choose the destination directory on the host that runs the browser.
  2. Create the directory if it does not already exist, and confirm the Node.js process can write to it.
  3. Pass downloadBehavior: { policy: 'allow', downloadPath: '/absolute/path/to/downloads' } in the launch or connect options.
  4. Trigger the page’s download, then inspect the chosen directory and handle the resulting file in your automation.

The option configures browser handling of downloads; it does not itself trigger a download or provide a separate wait-for-file-complete API.

Do not confuse page downloads with browser installation

Puppeteer’s downloadBehavior controls page-triggered file downloads at runtime. Installing the puppeteer package is a different workflow: that package downloads a compatible browser during installation, while puppeteer-core does not download Chrome when installed. If a package manager blocks install scripts and the required browser is missing, Puppeteer documents npx puppeteer browsers install as a manual browser-installation remedy. That command installs a browser; it does not set a page download directory. See the installation guide.

Troubleshooting download behavior

  • Downloads are not permitted: Check that the policy is allow or allowAndName, rather than deny or default.
  • The API rejects a missing path: Supply downloadPath for either allow or allowAndName.
  • No file appears at the destination: Confirm the page actually triggered a download, the path is valid for the browser host, and the browser process has write access. Also verify that you are inspecting the host where the browser is running.
  • The downloaded filename is unexpected: If using allowAndName, filenames follow download GUIDs. Use allow if that naming behavior is not wanted.
  • Puppeteer reports that its browser is missing: This is an installation issue, not a download-directory setting. Consult the installation guide and, where relevant, use npx puppeteer browsers install.
  • Behavior differs after connecting or across browsers: Check the installed Puppeteer version and exact browser/protocol combination. The stable API documentation does not provide a complete compatibility matrix.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If the goal is a screenshot or PDF of a web page rather than downloading a file through page automation, ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. Its clean-shot steps can accept consent banners and remove known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server includes tools for AI agents to take screenshots, inspect page information, and capture PDFs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example cURL request (replace YOUR_API_KEY with your key):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.