libnick 2025.7.3
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
Nickvision::Network::Web Namespace Reference

Functions

bool getWebsiteExists (const std::string &url)
 Gets whether or not a url points to a valid website.
boost::json::value getJson (const std::string &url)
 Makes a GET request for json from a url.
bool downloadFile (const std::string &url, const std::filesystem::path &path, const cpr::ProgressCallback &progress={}, bool overwrite=true)
 Downloads a file to disk.

Function Documentation

◆ downloadFile()

bool Nickvision::Network::Web::downloadFile ( const std::string & url,
const std::filesystem::path & path,
const cpr::ProgressCallback & progress = {},
bool overwrite = true )

Downloads a file to disk.

Parameters
urlThe url of the file to download
pathThe path on disk to save the file
progressAn optional function to receive progress on the download
overwriteWhether or not to overwrite existing files on disk

◆ getJson()

boost::json::value Nickvision::Network::Web::getJson ( const std::string & url)

Makes a GET request for json from a url.

Parameters
urlThe url of the json resource
Returns
The parsed json value
An empty json value if error

◆ getWebsiteExists()

bool Nickvision::Network::Web::getWebsiteExists ( const std::string & url)

Gets whether or not a url points to a valid website.

Parameters
urlThe url to check
Returns
True if valid website, else false