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

# Download files

## Recipe

This recipe shows how to download files triggered by a button click or link with [`downloadFile`](https://intunedhq.com/docs/automation-sdks/intuned-sdk/typescript/helpers/functions/downloadFile) (TypeScript) or [`download_file`](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/functions/download_file) (Python).

```typescript TypeScript theme={null}
import { BrowserContext, Page } from "playwright";
import { downloadFile } from "@intuned/browser"

interface Params {
  // Add your params here
}

export default async function handler(
  params: Params,
  page: Page,
  context: BrowserContext
) {
  await page.goto("https://sandbox.intuned.dev/pdfs")

  // Locate the download button
  const downloadLocator = page.locator("xpath=//tbody/tr[1]//*[name()='svg']")

  // Trigger download and wait for file
  const downloadedFile = await downloadFile({
    page,
    trigger: downloadLocator,
    timeoutInMs: 15000,
  })

  const fileName = downloadedFile.suggestedFilename()
  return fileName
}
```

```python Python theme={null}
from intuned_browser import download_file
from playwright.async_api import Page

async def automation(page: Page, params, **_kwargs):
    await page.goto("https://sandbox.intuned.dev/pdfs")

    # Locate the download button
    download_locator = page.locator("xpath=//tbody/tr[1]//*[name()='svg']")

    # Trigger download and wait for file
    downloaded_file = await download_file(
        page=page,
        trigger=download_locator,
        timeout_s=15,
    )

    file_name = downloaded_file.suggested_filename
    return file_name
```

## Related SDK methods

> [card] [downloadFile (TypeScript)](https://intunedhq.com/docs/automation-sdks/intuned-sdk/typescript/helpers/functions/downloadFile.md)
>
> TypeScript SDK helper for downloading files

> [card] [download\_file (Python)](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/functions/download_file.md)
>
> Python SDK helper for downloading files

> [card] [saveFileToS3 (TypeScript)](https://intunedhq.com/docs/automation-sdks/intuned-sdk/typescript/helpers/functions/saveFileToS3.md)
>
> TypeScript SDK helper for saving files to S3

> [card] [save\_file\_to\_s3 (Python)](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/functions/save_file_to_s3.md)
>
> Python SDK helper for saving files to S3

> [card] [Cookbook (Python)](https://github.com/Intuned/cookbook/tree/main/python-examples/quick-recipes)
>
> Python quick recipes in the Intuned Cookbook

> [card] [Cookbook (TypeScript)](https://github.com/Intuned/cookbook/tree/main/typescript-examples/quick-recipes)
>
> TypeScript quick recipes in the Intuned Cookbook


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.