28#include "nexuslua_export.h"
57 NEXUSLUA_EXPORT std::string
ReadHttp(
const std::string& URL,
const std::string& outFile =
"", std::function<
void(
DownloadProgress, std::string)> progress =
nullptr, std::function<
bool()> abort =
nullptr);
67 NEXUSLUA_EXPORT std::string
ReadHttp(
const std::string& host,
const std::string& port,
const std::string& path,
const std::string& outFile =
"", std::function<
void(
DownloadProgress, std::string)> progress =
nullptr, std::function<
bool()> abort =
nullptr);
77 NEXUSLUA_EXPORT std::string
ReadHttps(
const std::string& host,
const std::string& port,
const std::string& path,
const std::string& outFile =
"", std::function<
void(
DownloadProgress, std::string)> progress =
nullptr, std::function<
bool()> abort =
nullptr);
80 NEXUSLUA_EXPORT
void ParseHostPortPath(std::string URL, std::string& host, std::string& port, std::string& path);
81 NEXUSLUA_EXPORT
bool Unzip(std::filesystem::path zip_file, std::filesystem::path target_dir);
82 NEXUSLUA_EXPORT
bool Zip(std::filesystem::path source_dir, std::filesystem::path zip_file);
various helper functions
Definition utility.hpp:50
NEXUSLUA_EXPORT void ParseHostPortPath(std::string URL, std::string &host, std::string &port, std::string &path)
splits up the given URL into the three components host, port and path and sets the reference paramete...
NEXUSLUA_EXPORT std::string RemoveWsFromParams(std::string signature)
removes redundant white spaces from the given function signature
NEXUSLUA_EXPORT std::string ReadHttps(const std::string &host, const std::string &port, const std::string &path, const std::string &outFile="", std::function< void(DownloadProgress, std::string)> progress=nullptr, std::function< bool()> abort=nullptr)
reads a file from a the given URL
NEXUSLUA_EXPORT std::string ReadHttp(const std::string &URL, const std::string &outFile="", std::function< void(DownloadProgress, std::string)> progress=nullptr, std::function< bool()> abort=nullptr)
reads a file from a the given URL (no https)
NEXUSLUA_EXPORT bool Zip(std::filesystem::path source_dir, std::filesystem::path zip_file)
zips the given target directory to the given output zip file. Throws std::runtime_error in case of er...
NEXUSLUA_EXPORT bool Unzip(std::filesystem::path zip_file, std::filesystem::path target_dir)
unzips the given zip file to the given target dir. Throws std::runtime_error in case of errors.
The nexuslua library is implemented inside this namespace.
DownloadProgress
used by utils::ReadHttp to call a function to describe the download state, including a string with fu...
Definition utility.hpp:38
@ READING_HTTP_RESPONSE
Definition utility.hpp:41
@ DOWNLOADING
string will contain current download size
Definition utility.hpp:43
@ ABORTED
Definition utility.hpp:45
@ READING_DATA
Definition utility.hpp:42
@ CONNECTING
Definition utility.hpp:39
@ ERR
string will contain error message
Definition utility.hpp:44
@ SENDING_REQUEST
Definition utility.hpp:40