Learn R Programming

ngstk (version 0.2.3)

par_download: Function to download multiple file at the same time.

Description

Function to download multiple file at the same time.

Usage

par_download(urls, destfiles = NULL, logdir = sprintf("%s/logs",
  tempdir()), ids_func = function(urls) {     stri_rand_strings(n =
  length(urls), length = 20) }, logfn_func = function(ids, logdir) {    
  normalizePath(sprintf("%s/%s.log", logdir, ids), mustWork = FALSE) },
  parallel_method = "plan(multiprocess)", ...)

Arguments

urls

A character string naming the URLs of a resource to be downloaded.

destfiles

Default to use the basename of urls

logdir

Directory to store the download logs [tempdir()]

ids_func

Function to define the returned ids

logfn_func

Function to define the log files

parallel_method

Method for future parallel [plan(multiprocess)]

...

Other params pass to download.file

Value

A list

Examples

Run this code
# NOT RUN {
urls <- c(paste0('https://raw.githubusercontent.com/',
'Miachol/ftp/master/files/images/bioinstaller/maftools3.png'), 
paste0('https://raw.githubusercontent.com/',
'Miachol/ftp/master/files/images/bioinstaller/maftools4.png'))
# }
# NOT RUN {
par_download(urls, sprintf('%s/%s', tempdir(), basename(urls)))
# }

Run the code above in your browser using DataLab