library("tima")
# Download LOTUS database from Zenodo
get_last_version_from_zenodo(
doi = "10.5281/zenodo.5794106",
pattern = "lotus.csv.gz",
path = "data/source/libraries/sop/lotus.csv.gz"
)
# The function will skip download if file exists with correct size
get_last_version_from_zenodo(
doi = "10.5281/zenodo.5794106",
pattern = "lotus.csv.gz",
path = "data/source/libraries/sop/lotus.csv.gz"
)Get Latest Version from Zenodo
Description
Retrieves the latest version of a file from a Zenodo repository record. This function checks the file size and only downloads if the local file is missing or differs from the remote version. Implements robust error handling and retry logic.
Usage
get_last_version_from_zenodo(doi, pattern, path)
Arguments
doi
|
Character. Zenodo DOI (e.g., "10.5281/zenodo.5794106") |
pattern
|
Character. Pattern to identify the specific file to download |
path
|
Character. Local path where the file should be saved |
Details
Credit goes partially to https://inbo.github.io/inborutils/
This function:
-
Validates DOI format and input parameters
-
Fetches the latest version metadata from Zenodo API
-
Finds files matching the specified pattern
-
Compares local and remote file sizes to avoid unnecessary downloads
-
Downloads only if needed, with retry logic
-
Creates necessary directories automatically
Value
Character path to the downloaded (or existing) file