From 2d2e059f4f83f27e18ffd753d642f53546f32293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigbj=C3=B8rn=20Skj=C3=A6ret?= Date: Wed, 28 May 2025 09:50:41 +0200 Subject: [PATCH] make common_download_file_single/multiple public --- common/arg.cpp | 4 ++-- common/arg.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/arg.cpp b/common/arg.cpp index 69a58364f..8e40d85bc 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -242,7 +242,7 @@ static bool curl_perform_with_retry(const std::string & url, CURL * curl, int ma } // download one single file from remote URL to local path -static bool common_download_file_single(const std::string & url, const std::string & path, const std::string & bearer_token, bool offline) { +bool common_download_file_single(const std::string & url, const std::string & path, const std::string & bearer_token, bool offline) { // Check if the file already exists locally auto file_exists = std::filesystem::exists(path); @@ -465,7 +465,7 @@ static bool common_download_file_single(const std::string & url, const std::stri // download multiple files from remote URLs to local paths // the input is a vector of pairs -static bool common_download_file_multiple(const std::vector> & urls, const std::string & bearer_token, bool offline) { +bool common_download_file_multiple(const std::vector> & urls, const std::string & bearer_token, bool offline) { // Prepare download in parallel std::vector> futures_download; for (auto const & item : urls) { diff --git a/common/arg.h b/common/arg.h index 70bea100f..0a7400d06 100644 --- a/common/arg.h +++ b/common/arg.h @@ -87,3 +87,10 @@ struct common_remote_params { }; // get remote file content, returns std::pair> common_remote_get_content(const std::string & url, const common_remote_params & params); + +// download one single file from remote URL to local path +bool common_download_file_single(const std::string & url, const std::string & path, const std::string & bearer_token, bool offline); + +// download multiple files from remote URLs to local paths +// the input is a vector of pairs +bool common_download_file_multiple(const std::vector> & urls, const std::string & bearer_token, bool offline);