CURLOPT_RESUME_FROM(3)
π CURLOPT_RESUME_FROM π
okay so bestie, this is a page from the libcurl manual β the CURLOPT_RESUME_FROM(3) one β and it's literally about picking the byte offset your transfer resumes from. slay. let's get into it π«Ά
β¨ NAME β¨
CURLOPT_RESUME_FROM β the offset to resume a transfer from π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM, long from);
π¦ DESCRIPTION π¦
So you pass in a long as the parameter, right? That's your offset β in number of bytes β for where you want the transfer to start from. lowkey simple π
Set this option to 0 and the transfer starts from the very beginning, which effectively disables resume. icon energy, back to square one.
For FTP specifically, set this option to -1 and the transfer starts from the end of the target file β which is genuinely so useful for continuing an interrupted upload. no cap π₯
When you're doing uploads with FTP, the resume position is where in the local/source file libcurl should try to resume the upload from, and it then appends the source file onto the remote target file. the way that works is honestly so clean.
π one thing though: if you need to resume a transfer beyond the 2GB limit, use CURLOPT_RESUME_FROM_LARGE(3) instead. don't come crying to this option, it can't help you there.
π DEFAULT π
0, not used
π PROTOCOLS π
This functionality affects all supported protocols β¨ (yes, all of them, main character behaviour)
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
long size_of_file = 6789;
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
/* resume upload at byte index 200 */
curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L);
/* ask for upload */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* set total data amount to expect */
curl_easy_setopt(curl, CURLOPT_INFILESIZE, size_of_file);
/* Perform the request */
curl_easy_perform(curl);
}
}
like, look at her go ππ byte index 200, uploading, total size set, request performed. ate.
β AVAILABILITY β
Added in curl 7.1 β she's been around a minute, a real veteran π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK. non-zero means an error occurred β go check libcurl-errors(3) for the tea π
π SEE ALSO π
and that's the whole page, bestie π§π« this one came from the libcurl manual, dated 2026-10-12, and it's the CURLOPT_RESUME_FROM(3) page. go resume something iconic π
β¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms