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