diff --git a/R/internals_RLum.R b/R/internals_RLum.R index 8726b6bc3..6b7b10468 100644 --- a/R/internals_RLum.R +++ b/R/internals_RLum.R @@ -751,6 +751,8 @@ fancy_scientific <- function(l) { url = url, destfile = destfile, quiet = TRUE, + mode = "wb", + cacheOK = FALSE, method = "auto"), warning = function(w) { message("FAILED ", appendLF = TRUE) diff --git a/R/read_BIN2R.R b/R/read_BIN2R.R index 542bbe56c..580f98fa2 100644 --- a/R/read_BIN2R.R +++ b/R/read_BIN2R.R @@ -265,6 +265,24 @@ read_BIN2R <- function( # Config -------------------------------------------------------------------------------------- + ##set file_link for internet downloads + url_file <- NULL + on_exit <- function(){ + ##unlink internet connection + if(!is.null(url_file)){ + unlink(url_file) + } + + ##close connection + if(exists("con") && !is.null(con)){ + close(con) + + } + + + } + on.exit(expr = on_exit()) + ## check for URL and attempt download if(verbose) url_file <- .download_file(file, tempfile("read_BIN22R_FILE", fileext = ".binx")) @@ -300,7 +318,6 @@ read_BIN2R <- function( # Short file parsing to get number of records ------------------------------------------------- #open connection con <- file(file, "rb") - on.exit(close(con)) ##get information about file size file.size <- file.info(file)