> For the complete documentation index, see [llms.txt](https://docs.thousandeyes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/use-cases/uploading-downloading/transaction-scripting-examples-for-file-downloads.md).

# Transaction Scripting Examples for File Downloads

The [transaction scripting examples repository](https://github.com/thousandeyes/transaction-scripting-examples) contains some sample scripts that include file upload and download operations. If you use these examples, keep in mind you will have to modify or adjust these scripts for your particular context.

* In the **/examples** folder, [WaitForDownload.js](https://github.com/thousandeyes/transaction-scripting-examples/blob/master/examples/waitForDownload.js) is a script fragment that you can add into your own transaction script to wait for a specified period of time for a file to download. Note that this is not a complete script.
* In the **/applications/Office365** folder:
  * [Onedrive-download.js](https://github.com/thousandeyes/transaction-scripting-examples/blob/master/applications/office-365/onedrive-download.js) is a complete sample script with steps to log into a specified personal SharePoint drive and download a file called “Public Cloud Performance Benchmark Report Final.pdf”.
  * [Sharepoint-login-download.js](https://github.com/thousandeyes/transaction-scripting-examples/blob/master/applications/office-365/sharepoint-login-download.js) is similar to **onedrive-download.js**, except actions are logging in to a company-wide SharePoint site, navigating to the Shared Documents area, and downloading a specified file by name.

## Simple Use Case

One common use case involves timing the performance of uploading or downloading a file. A sample transaction test script might contain something similar to this, with markers to capture the timing:

```
await markers.start("File Download");
await downloads.waitForDownload('somefile.pdf');
await markers.stop("File Download");
```

You can then include the “File Download” metric in dashboards, reports, and alerts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/use-cases/uploading-downloading/transaction-scripting-examples-for-file-downloads.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
