> ## 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`](/automation-sdks/intuned-sdk/typescript/helpers/functions/downloadFile) (TypeScript) or [`download_file`](/automation-sdks/intuned-sdk/python/helpers/functions/download_file) (Python).

<CodeGroup dropdown>
  ```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
  ```
</CodeGroup>

## Related SDK methods

<CardGroup cols={2}>
  <Card title="downloadFile (TypeScript)" icon="js" href="/automation-sdks/intuned-sdk/typescript/helpers/functions/downloadFile">
    TypeScript SDK helper for downloading files
  </Card>

  <Card title="download_file (Python)" icon="python" href="/automation-sdks/intuned-sdk/python/helpers/functions/download_file">
    Python SDK helper for downloading files
  </Card>

  <Card title="saveFileToS3 (TypeScript)" icon="js" href="/automation-sdks/intuned-sdk/typescript/helpers/functions/saveFileToS3">
    TypeScript SDK helper for saving files to S3
  </Card>

  <Card title="save_file_to_s3 (Python)" icon="python" href="/automation-sdks/intuned-sdk/python/helpers/functions/save_file_to_s3">
    Python SDK helper for saving files to S3
  </Card>

  <Card title="Cookbook (Python)" icon="github" href="https://github.com/Intuned/cookbook/tree/main/python-examples/quick-recipes">
    Python quick recipes in the Intuned Cookbook
  </Card>

  <Card title="Cookbook (TypeScript)" icon="github" href="https://github.com/Intuned/cookbook/tree/main/typescript-examples/quick-recipes">
    TypeScript quick recipes in the Intuned Cookbook
  </Card>
</CardGroup>
