Repository navigation
Pause and Resume
Qriist edited this page Sep 16, 2026
·
1 revision
Pause halts an easy handle's active download or upload while keeping the underlying connection alive:
curl.Pause(easy_handle)UnPause resumes the halted transfer from the exact byte offset where it stopped:
curl.UnPause(easy_handle)Pausing is most useful within an Async pool, allowing you to temporarily freeze specific handles without breaking the connection or losing progress. The running handle count returned by Async() will reflect paused handles as no longer "running":
easyA := curl.Init()
easyB := curl.Init()
curl.SetOpt("URL", "https://example.com/large-file.zip", easyA)
curl.WriteToFile("C:\downloads\fileA.bin", easyA)
curl.SetOpt("URL", "https://example.com/another-file.zip", easyB)
curl.WriteToFile("C:\downloads\fileB.bin", easyB)
curl.ReadyAsync([easyA, easyB])
Loop {
running := curl.Async()
; Pause one handle after a short interval or based on a condition
if (running = 2 && !pauseStarted) {
out .= "Pausing handle..."
curl.Pause(easyB)
pauseStarted := true
}
; Resume after some time or event
if (conditionMet && running < 2) {
out .= "Resuming handle..."
curl.UnPause(easyB)
}
} Until !running
out .= "Total elapsed: " DateDiff(A_StartupTime, A_NowUTC, "Seconds") " seconds."
msgbox out- Pausing does not disconnect the handle. Network state is preserved.
- Works seamlessly within
Async()multi_handle pools alongside other active or paused handles. - See Async and Multi Interface for pool management details.
- WebSocket — framed protocol-level messaging
- Easy Handle Reference — full method list
Foundations
Operations
- Download Modes
- Setting and Listing Options
- Setting and Inspecting Headers
- POST and Upload
- Multiple Easy Handles
- Async and Multi Interface
- URL Construction
- Share Interface
- MIME and Multipart
- Raw Send and Receive
- Pause and Resume
- WebSocket
- SSL Sessions
- Debug and Diagnostics
API Reference
- Easy Handle Reference
- Multi Handle Reference
- Share Handle Reference
- MIME Handle Reference
- URL Handle Reference
- Utility Methods Reference
- WebSocket Reference
Code Snippets