Read a file and download from a URL if necessary. More...
#include <cloud_file.h>
mkdir -p
, thus will probably only work on unix-like systems.curl
or wget
which must be installed separatley.Definition at line 60 of file cloud_file.h.
Public Attributes | |
bool | allow_wget |
If true, allow the use of wget to download the file (default true) More... | |
bool | allow_curl |
If true, allow the use of curl to download the file (default true) More... | |
int | verbose |
Verbosity parameter (default 1) | |
bool | throw_on_fail |
If true, throw an exception on failure (default true) | |
Specify hash type | |
int | hash_type |
Current hash type (default sha256) | |
static const int | sha256 =0 |
static const int | md5 =1 |
static const int | md5sum =2 |
cloud_file () | |
int | hdf5_open (hdf_file &hf, std::string file, std::string url, std::string dir="") |
Open an HDF file named file in directory dir downloading from URL url if necessary. | |
int | hdf5_open_hash (hdf_file &hf, std::string file, std::string url, std::string hash, std::string dir="") |
Open an HDF file named file in directory dir with hash hash , downloading from URL url if necessary. | |
int | get_file (std::string file, std::string url, std::string dir="") |
Get file named file in directory dir from url url . | |
int | get_file_hash (std::string file, std::string url, std::string hash="", std::string dir="") |
Get file named file in directory dir in subdirectory subdir from url url . More... | |
int o2scl_hdf::cloud_file::get_file_hash | ( | std::string | file, |
std::string | url, | ||
std::string | hash = "" , |
||
std::string | dir = "" |
||
) |
This function begins with the directory dir
. If dir
is not present and cannot be created, the user is prompted for the correct data directory. This function then searches for file file
in the directory. If it is found, it is compared with the specified hash. If the hash matches, then the full filename is returned. If the hash does not match or if the file is not found, then this function uses curl (or wget if curl was unsuccessful) to download the file from url
. The file is then compared with the hash again, and the full filename is returned if the hash matches. Otherwise the error handler is called.
bool o2scl_hdf::cloud_file::allow_curl |
Definition at line 71 of file cloud_file.h.
bool o2scl_hdf::cloud_file::allow_wget |
Definition at line 67 of file cloud_file.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).