What is P2P Download?
P2P downloads let you receive a real-time notification the moment a file is downloaded in your browser session, then fetch the file directly from the active session — no polling, no waiting for Anchor to process the file, no storage APIs required.How It Works
Traditional downloads:
Browser downloads file → Anchor stores the file → You poll GET /downloads → Fetch from Anchor storage
P2P downloads:
Browser downloads file → Anchor.downloadReady CDP event fires → You fetch directly from the browser
When a file is downloaded, the browser emits a custom CDP event (Anchor.downloadReady) over your existing WebSocket connection. The event includes a pre-built fetch URL that streams the file bytes directly from the browser’s disk.
Implementation
Connect to the session and listen for the CDP event
Connect Playwright over CDP as usual, then open a
CDPSession on the page to listen for the Anchor.downloadReady event.The Anchor.downloadReady Event
The event is emitted on the CDP WebSocket connection as soon as the file lands on disk.
| Field | Description |
|---|---|
localDownloadId | Unique ID for this download, valid for the lifetime of the session |
suggestedFilename | The filename as suggested by the browser |
url | The URL the file was downloaded from |
originUrl | The page URL where the download was triggered |
size | File size in bytes |
duration | Time to complete the download in milliseconds |
p2pDownloadUrl | Relative URL to fetch the file — prepend your API base URL |
Fetch Endpoint
| Status | Meaning |
|---|---|
200 | File streamed successfully |
404 | local_download_id not found (may have expired with the session) |
410 | Session is no longer active — use the standard /downloads/:id/fetch instead |
Limitations
- The P2P fetch URL is only valid while the session is running. After the session ends, the file is no longer accessible via this endpoint.
- Files are still stored by Anchor in the background as a fallback. Once the session completes, they are accessible via the standard list session downloads API.
- Blob and data URL downloads (files generated client-side in JavaScript) are supported.

