# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
