osfr
osfr copied to clipboard
Feature request: download specific file versions
It would be very useful to add an argument to either osf_retrieve_file()
or osf_download()
to choose a specific file version to download. Currently I had to resort to manually downloading specific versions using utils::download.file()
. Hope to see something like this in the future!
Hi @eshom. I agree file version support would be a useful addition to osfr. It's definitely on the roadmap.
@eshom , would you mind sharing your code with the manual solution? I'm trying to figure out a way to do this programmatically, but can't see how.
@egouldo Sure! Here's a reproducible example:
tmp <- tempfile()
base_url <- "https://osf.io/"
download_version_endpoint <- "/download?version="
quality_metrics <- "qpfw5"
version <- 1
download_url <- paste0(base_url, quality_metrics, download_version_endpoint, version)
cat("Downloading:\n")
download.file(download_url, tmp)
cat("Deleting", paste0("'", tmp, "'"), "\n")
file.remove(tmp)
Awesome, thanks so much @eshom !