> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudcruise.com/llms.txt
> Use this file to discover all available pages before exploring further.

# File Download

> Capture and store downloaded files

The **File Download** node waits for a file download to complete and stores it with metadata. This node does **not** trigger the download itself—the download must be initiated by a previous action (e.g., a Click node on a download button). The exception is when `trigger_print` is set, which triggers the browser's print dialog for PDF generation.

The node polls for a download to complete before timing out. By default, the timeout is 60 seconds, but this can be configured using the `timeout_seconds` parameter.

## Parameters

| Parameter                     | Type    | Required | Description                                                                                                                                   |
| ----------------------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `metadata`                    | object  | Yes      | Metadata to attach to the downloaded file for identification in results                                                                       |
| `trigger_print`               | boolean | No       | If true, trigger browser print dialog for PDF generation instead of waiting for a download                                                    |
| `continue_on_failed_download` | boolean | No       | If true, continue workflow even if no download is detected within the timeout                                                                 |
| `timeout_seconds`             | number  | No       | Maximum time in seconds to wait for a download to complete. Default: 60. Range: 5-300                                                         |
| `expect_print_dialog`         | boolean | No       | Immediately send OS-level key sequences to save from a print dialog opened by the preceding action. See [caution below](#expect-print-dialog) |

## Examples

### Capture a Download

First trigger the download with a Click node, then capture it:

```json theme={null}
{
  "id": "click-download",
  "name": "Click download button",
  "action": "CLICK",
  "parameters": {
    "execution": "STATIC",
    "selector": "//button[@id='download-report']"
  }
}
```

Then capture the file. You can include workflow context in the metadata:

```json theme={null}
{
  "id": "abc123",
  "name": "Capture invoice download",
  "action": "FILE_DOWNLOAD",
  "parameters": {
    "metadata": {
      "invoice_id": "{{context.invoice_id}}",
      "customer": "{{context.customer_name}}",
      "date": "{{context.invoice_date}}"
    }
  }
}
```

## Expect Print Dialog

<Warning>
  `expect_print_dialog` does **not** wait for or detect a print dialog. When enabled, the agent immediately sends OS-level key sequences (e.g. Cmd+S / Ctrl+S, Enter) to save from a print dialog **as soon as the preceding action completes**. It assumes the dialog is already open.

  If the print dialog has not appeared — for example, if the preceding Click failed to open it — the keystrokes will be sent to the underlying page. This can cause unintended actions such as clicking buttons, submitting forms, or changing data on the page.
</Warning>

Only enable this when you are certain the previous step (e.g. a Click node) reliably opens a native print dialog. The typical pattern is:

1. **Click node** — clicks a "Print" button that opens the browser's native print dialog
2. **File Download node** with `expect_print_dialog: true` — immediately sends keystrokes to save the printed PDF

If the print dialog does not open reliably, consider adding a Delay node between the Click and File Download, or verifying the dialog appears before enabling this flag.

## Notes

* This node waits for a download. Use a Click node before it to trigger the actual download
* Only **one download** can be captured per File Download node. If multiple downloads are triggered, only the last one is captured
* To capture multiple files, use separate Click → File Download node pairs for each file
* Downloaded files are stored and accessible in the workflow results
* Downloaded files are added to the `file_urls` array in the response payload (available in both the API response and webhook events)
* Each downloaded file triggers a [`file.uploaded`](/concepts/webhooks#file.uploaded) webhook event with the signed file URL and metadata
* The `trigger_print` option triggers the browser print dialog for PDF generation
* Set `continue_on_failed_download: true` for optional downloads that shouldn't fail the workflow
* Downloaded files are limited to **100 MB**. Larger files fail the node with an upload error
* Supported file types: PDF, images (PNG, JPEG, GIF, WebP), text, CSV, JSON, XML, Excel (XLS, XLSX), Word (DOCX), and ZIP
* Signed file URLs expire based on your workspace settings (default: 7 days, configurable from 1 hour to 7 days). Configure this in [workspace settings](https://app.cloudcruise.com/settings/data-retention)
* The node times out after the configured `timeout_seconds` (default: 60 seconds) if no download is detected
