-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#' @name download_zenodo | ||
#' @aliases download_zenodo | ||
#' @title download_zenodo | ||
#' @description \code{download_zenodo} allows to execute a workflow | ||
#' | ||
#' @usage download_zenodo("10.5281/zenodo.2547036") | ||
#' | ||
#' @param doi a Zenodo DOI or concept DOI | ||
#' @param path the target directory where to download files | ||
#' @param logger a logger to print messages. The logger can be either NULL, | ||
#' "INFO" (with minimum logs), or "DEBUG" (for complete curl http calls logs) | ||
#' @param ... any other arguments for parallel downloading (more information at | ||
#'\link{ZenodoManager}, \code{downloadFiles()} documentation) | ||
#' | ||
#' @export | ||
#' | ||
download_zenodo = function(doi, path = ".", logger = NULL, ...){ | ||
|
||
zenodo <- ZenodoManager$new(logger = logger) | ||
rec <- zenodo$getRecordByDOI(doi) | ||
if(is.null(rec)){ | ||
#try to get it as concept DOI | ||
rec <- zenodo$getRecordByConceptDOI(doi) | ||
if(is.null(rec)){ | ||
stop("The DOI specified doesn't match any existing Zenodo DOI or concept DOI") | ||
} | ||
} | ||
#download | ||
rec$downloadFiles(path = path, ...) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.