candle.file_utils.get_file

Contents

candle.file_utils.get_file#

candle.file_utils.get_file(fname, origin, unpack=False, md5_hash=None, cache_subdir='common', datadir=None)#

Downloads a file from a URL if it not already in the cache. Passing the MD5 hash will verify the file after download as well as if it is already present in the cache.

Parameters:
  • fname (string) – name of the file

  • origin (string) – original URL of the file

  • unpack (bool) – whether the file should be decompressed

  • md5_hash (string) – MD5 hash of the file for verification

  • cache_subdir (string) – directory being used as the cache

  • datadir (string) – if set, datadir becomes its setting (which could be e.g. an absolute path) and cache_subdir no longer matters

Returns:

Path to the downloaded file

Return type:

string