CURLOPT_RESUME_FROM.3 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .\" generated by cd2nroff 0.1 from CURLOPT_RESUME_FROM.md
  2. .TH CURLOPT_RESUME_FROM 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_RESUME_FROM \- offset to resume transfer from
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM, long from);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long as parameter. It contains the offset in number of bytes that you
  12. want the transfer to start from. Set this option to 0 to make the transfer
  13. start from the beginning (effectively disabling resume). For FTP, set this
  14. option to \-1 to make the transfer start from the end of the target file
  15. (useful to continue an interrupted upload).
  16. When doing uploads with FTP, the resume position is where in the local/source
  17. file libcurl should try to resume the upload from and it then appends the
  18. source file to the remote target file.
  19. If you need to resume a transfer beyond the 2GB limit, use
  20. \fICURLOPT_RESUME_FROM_LARGE(3)\fP instead.
  21. .SH DEFAULT
  22. 0, not used
  23. .SH PROTOCOLS
  24. This functionality affects all supported protocols
  25. .SH EXAMPLE
  26. .nf
  27. int main(void)
  28. {
  29. CURL *curl = curl_easy_init();
  30. if(curl) {
  31. long size_of_file;
  32. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
  33. /* resume upload at byte index 200 */
  34. curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L);
  35. /* ask for upload */
  36. curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
  37. /* set total data amount to expect */
  38. curl_easy_setopt(curl, CURLOPT_INFILESIZE, size_of_file);
  39. /* Perform the request */
  40. curl_easy_perform(curl);
  41. }
  42. }
  43. .fi
  44. .SH AVAILABILITY
  45. Added in curl 7.1
  46. .SH RETURN VALUE
  47. Returns CURLE_OK
  48. .SH SEE ALSO
  49. .BR CURLOPT_INFILESIZE (3),
  50. .BR CURLOPT_RANGE (3),
  51. .BR CURLOPT_RESUME_FROM_LARGE (3)