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

Description Usage Arguments Value Examples

View source: R/future.R

Description

Function to download multiple file at the same time.

Usage

1
2
3
4
5
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

1
2
3
4
5
6
7
8
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)))

## End(Not run)

JhuangLab/ngstk documentation built on May 28, 2019, 12:43 p.m.