Added CMakeLists.txt to File-Downloader

This commit is contained in:
2026-04-07 10:40:19 +02:00
commit 2c1fbaf4c6
10 changed files with 399 additions and 0 deletions

35
downloader.h Normal file
View File

@@ -0,0 +1,35 @@
#pragma once
#include "console.h"
class FileDownloader {
private:
// Struct to encapsulate download progress data
struct DownloadProgress {
curl_off_t bytesDownloaded;
curl_off_t totalSize;
std::chrono::steady_clock::time_point startTime;
DownloadProgress() : bytesDownloaded(0), totalSize(0), startTime(std::chrono::steady_clock::now()) {}
};
std::string url;
std::string filename;
CURL* curl;
FILE* file;
bool check;
bool Downloader();
static int progressCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
public:
FileDownloader(const std::string& xurl);
~FileDownloader();
void download();
};