Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: download specific file versions #136

Open
eshom opened this issue Dec 31, 2020 · 4 comments
Open

Feature request: download specific file versions #136

eshom opened this issue Dec 31, 2020 · 4 comments

Comments

@eshom
Copy link

eshom commented Dec 31, 2020

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!

@aaronwolen
Copy link
Member

Hi @eshom. I agree file version support would be a useful addition to osfr. It's definitely on the roadmap.

@egouldo
Copy link

egouldo commented Aug 26, 2021

@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.

@eshom
Copy link
Author

eshom commented Aug 26, 2021

@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)

@egouldo
Copy link

egouldo commented Aug 26, 2021

Awesome, thanks so much @eshom !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants