Network download helpers built on top of libcurl.
More...
#include <stdio.h>
Go to the source code of this file.
|
| size_t | write_data (void *, size_t, size_t, void *) |
| | libcurl write callback used when storing response data to a file.
|
| int | download_file (const char *, const char *) |
| | Download a file from URL to a destination path.
|
Network download helpers built on top of libcurl.
- Author
- ZouariOmar (zouar.nosp@m.ioma.nosp@m.r20@g.nosp@m.mail.nosp@m..com)
- Version
- 0.3
- Date
- 2026-03-18
- Copyright
- Copyright (c) 2025
crun_libcurl.h
◆ CURL_CA_CERT_NAME
| #define CURL_CA_CERT_NAME "cacert-2026-03-19.pem" |
◆ CURL_CA_CERT_REMOTE_PATH
| #define CURL_CA_CERT_REMOTE_PATH "https://curl.se/ca/" CURL_CA_CERT_NAME |
◆ download_file()
| int download_file |
( |
const char * | url, |
|
|
const char * | out ) |
Download a file from URL to a destination path.
- Parameters
-
| url | Remote URL. |
| out | Destination file path. |
- Returns
- int EXIT_SUCCESS on success, EXIT_FAILURE otherwise.
◆ write_data()
| size_t write_data |
( |
void * | ptr, |
|
|
size_t | size, |
|
|
size_t | nmemb, |
|
|
void * | stream ) |
libcurl write callback used when storing response data to a file.
- Parameters
-
| ptr | Pointer to downloaded bytes. |
| size | Size of each element. |
| nmemb | Number of elements. |
| stream | Destination stream. |
- Returns
- size_t Number of bytes written.