Read a file and download from a URL if necessary. More...
#include <cloud_file.h>
Public Member Functions | |
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 hash, std::string url, std::string dir="") |
Open an HDF file named file in directory dir with hash hash , downloading from URL url if necessary. | |
int | hdf5_open_subdir (hdf_file &hf, std::string file, std::string subdir, std::string url, std::string dir="") |
Open an HDF file named file in directory dir in subdirectory subdir , downloading from URL url if necessary. | |
int | hdf5_open_hash_subdir (hdf_file &hf, std::string file, std::string hash, std::string subdir, std::string url, std::string dir="") |
Open an HDF file named file in directory dir in subdirectory subdir with hash hash , downloading from URL url if necessary. | |
int | get_file (std::string file, std::string url, std::string &fname, std::string dir="") |
Get file named file in directory dir in subdirectory subdir from url url . | |
int | get_file_hash (std::string file, std::string hash, std::string url, std::string &fname, std::string dir="") |
Get file named file in directory dir in subdirectory subdir from url url . | |
int | get_file_subdir (std::string file, std::string subdir, std::string url, std::string &fname, std::string dir="") |
Get file named file in directory dir in subdirectory subdir from url url . | |
int | get_file_hash_subdir (std::string file, std::string hash, std::string subdir, std::string url, std::string &fname, std::string dir="") |
Get file named file in directory dir in subdirectory subdir from url url . More... | |
Public Attributes | |
bool | allow_wget |
If true, allow the use of wget to download the file (default true) | |
bool | allow_curl |
If true, allow the use of curl to download the file (default true) | |
int | verbose |
Verbosity parameter (default 1) | |
bool | throw_on_fail |
If true, throw an exception on failure (default true) | |
std::string | env_var |
The environment variable which stores the directory (default "") | |
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 |
mkdir -p
, thus will probably only work on unix-like systems.Definition at line 57 of file cloud_file.h.
int o2scl_hdf::cloud_file::get_file_hash_subdir | ( | std::string | file, |
std::string | hash, | ||
std::string | subdir, | ||
std::string | url, | ||
std::string & | fname, | ||
std::string | dir = "" |
||
) |
This function attempts to find a file named file
in subdirectory subdir
of the data directory dir
. If dir
is empty, it attempts to set it equal to the value of the environment variable env_var. If that environment variable is not present, the user is prompted for the correct data directory. If the file is not found, then this function uses curl (or wget if curl was unsuccessful) to download the file from url
. If this process was successful at finding or downloading the file, then the full filename is returned. Otherwise, an exception is thrown.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).