sample.pdf becomes sample-1719265797164.pdf).
View or run the example template here
Triggering downloads
First, trigger a download in your browser automation:- Create a browser session and get the session ID
- Connect to the session using your preferred framework
- Configure your library’s downloads location
- Perform the download action in your automation script
- Node.js
- Python
Retrieving downloaded files
After triggering downloads, retrieve them with the SDK.downloads.list, downloads.retrieve, downloads.download, and downloads.delete call the Downloads API. You can list, filter, retrieve, and delete individual files.
These examples need
@browserbasehq/sdk 2.27.0 or later, and browserbase 1.26.0 or later.Files sync in real time, but large downloads may not be immediately available
through the
/downloads endpoint. The code below includes retry logic to
handle this.List downloads
List all downloads for a session with optional filtering by filename, MIME type, file size, and creation time.- Node.js
- Python
Node.js
Filtering options
Example with filters:
- Node.js
- Python
Node.js
Get a download
Retrieve metadata withdownloads.retrieve, or the file bytes with downloads.download.
- Node.js
- Python
Node.js
Delete a download
Remove a download from storage. Returns204 No Content on success.
- Node.js
- Python
Node.js
Download object
Each download contains the following fields:List downloads
List and filter downloads
Get download
Get metadata or file content
Delete download
Remove a download
Browser files
Work with files in browser sessions.