The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
download.c File Reference

librat: download a file with libcurl. More...

#include "internal.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <curl/curl.h>

Functions

int rat_download (const char *url, const char *path, uint64_t max_size, rat_progress_t progress, void *context, rat_error_t *err)
 download a URL into a file.

Detailed Description

librat: download a file with libcurl.

only https and file URLs are used (file is for tests and for a repository on a disk). a redirect must go to https too, as GitHub sends the release assets from another host.

Function Documentation

◆ rat_download()

int rat_download ( const char * url,
const char * path,
uint64_t max_size,
rat_progress_t progress,
void * context,
rat_error_t * err )

download a URL into a file.

only https and file URLs are used, and a redirect must go to https. on a failure the file is removed.

Parameters
max_sizethe largest file that is accepted.
progressgets the progress (may be NULL).
Returns
0, or -1.