Dylan_Gomes
Dylan_Gomes

Reputation: 2280

Error in uploading a large data file to Zenodo via R (necessary data rewind wasn't possible)

I am trying to upload a large data file to Zenodo via R, following this link (code pasted below for reproducibility).

# zenodo large file upload

library(httr) 
library(dplyr)
library(purrr)

# get your token here
# https://zenodo.org/account/settings/applications/
token <- "long_ugly_number_you_get_from_zenodo"
deposit_id <- 6137047 # fill in UI form to get this number
file <- "file_you_want_to_upload.zip"

bucket <- GET(paste0("https://www.zenodo.org/api/deposit/depositions/",deposit_id), 
add_headers(Authorization = paste("Bearer", token)),
encode = 'json'
) %>% 
content(as = "text") %>% 
jsonlite::fromJSON() %>% 
pluck("links") %>% 
pluck("bucket") %>% 
gsub("https://zenodo.org/api/files/","",.)

PUT(url = paste0("https://www.zenodo.org/api/files/",bucket,"/",file,"?access_token=",token), 
body = upload_file(file) # path to your local file
) %>% 
content(as = "text")

On the last line, I am getting the following error, and not sure what to do about it or what it means:

Error in curl::curl_fetch_memory(url, handle = handle) : 
  necessary data rewind wasn't possible

Upvotes: 0

Views: 54

Answers (0)

Related Questions