View source: R/CoreFunctions.R
fetchFile | R Documentation |
This is a helper function used in the USGSlidar package to call
utils::download.file()
to retrieve individual index files and data
tiles.
fetchFile(url, destfile, method = "libcurl", mode = "wb", ...)
url |
A character string with the URL for the file. If using local files,
the URL should start with |
destfile |
A character string specifying the file name for the downloaded file. |
method |
Method used with |
mode |
A character string indicating the mode with which to write the
file. Refer to |
... |
Additional arguments passed to |
When retrieving large files, it may be necessary to increase the timeout period so downloads can complete. This is done using the following line of code (sets timeout to 5000 seconds):
options(timeout = max(5000, getOption("timeout")))
An (invisible) integer code, 0 for success and non-zero for failure.
This is the value returned from download.file
.
## Not run:
fetchFile("sample", "ftp://somewebsite.com/files/samplefile.bin")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.