> ## Documentation Index
> Fetch the complete documentation index at: https://browseruse-0aece648-mintlify-cli-docs-1773354647.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# File Downloads

> Download files the agent saves during a task — PDFs, CSVs, images, and more.

When the agent downloads files during a task (e.g., exporting a report, saving an image), they are stored as output files. Retrieve them after the task completes using presigned URLs.

<CodeGroup>
  ```python Python theme={null}
  import httpx
  from browser_use_sdk import AsyncBrowserUse

  client = AsyncBrowserUse()
  result = await client.run("Download the latest PDF report from example.com/reports")

  task = await client.tasks.get(result.id)
  for file in task.output_files:
      output = await client.files.task_output(result.id, str(file.id))
      async with httpx.AsyncClient() as http:
          resp = await http.get(output.download_url)
      with open(file.file_name, "wb") as f:
          f.write(resp.content)
      print(f"Saved {file.file_name}")
  ```

  ```typescript TypeScript theme={null}
  import { BrowserUse } from "browser-use-sdk";
  import { writeFileSync } from "fs";

  const client = new BrowserUse();
  const result = await client.run("Download the latest PDF report from example.com/reports");

  const task = await client.tasks.get(result.id);
  for (const file of task.outputFiles) {
    const output = await client.files.taskOutput(result.id, file.id);
    const resp = await fetch(output.downloadUrl);
    writeFileSync(file.fileName, Buffer.from(await resp.arrayBuffer()));
    console.log(`Saved ${file.fileName}`);
  }
  ```
</CodeGroup>

<Note>
  Presigned URLs expire after a short time. Download files promptly after the task finishes.
</Note>
