| 1 |
\name{scp} |
| 2 |
\Rdversion{1.1} |
| 3 |
\alias{scp} |
| 4 |
\title{Retrieve contents of a file from a remote host via SCP (Secure Copy)} |
| 5 |
\description{ |
| 6 |
This function allows us to retrieve the contents of a file from a |
| 7 |
remote host via SCP. This is done entirely within R, rather than |
| 8 |
a command line application and the contents of the file are never |
| 9 |
written to disc. The function allows the |
| 10 |
} |
| 11 |
\usage{ |
| 12 |
scp(host, path, keypasswd = NA, user = getUserName(), rsa = TRUE, |
| 13 |
key = sprintf(c("~/.ssh/id_\%s.pub", "~/.ssh/id_\%s"), |
| 14 |
if (rsa) "rsa" else "dsa"), |
| 15 |
binary = NA, size = 5000, curl = getCurlHandle(), ...) |
| 16 |
} |
| 17 |
%- maybe also 'usage' for other objects documented here. |
| 18 |
\arguments{ |
| 19 |
\item{host}{the name of the remote host or its IP address} |
| 20 |
\item{path}{the path of the file of interest on the remote host's file |
| 21 |
systems} |
| 22 |
\item{keypasswd}{a password for accessing the local SSH key. This is |
| 23 |
the passphrase for the key.} |
| 24 |
\item{user}{the name of the user on the remote machine} |
| 25 |
\item{rsa}{a logical value indicating whether to use the RSA or DSA key} |
| 26 |
\item{key}{the path giving the location of the SSH key. } |
| 27 |
\item{binary}{a logical value giving } |
| 28 |
\item{size}{an estimate of the size of the buffer needed to store the |
| 29 |
contents of the file. This is used to initialize the buffer and |
| 30 |
potentially avoid resizing it as needed.} |
| 31 |
\item{curl}{a curl handle (\code{\link{getCurlHandle}}) that is to be |
| 32 |
reused for this request and which potentially contains numerous |
| 33 |
options settings or an existing connection to the host.} |
| 34 |
\item{\dots}{additional parameters handed to \code{\link{curlPerform}}.} |
| 35 |
} |
| 36 |
\details{This uses libcurl's facilities for scp. |
| 37 |
Use \code{"scp" \%in\% curlVersion()$protocols} to |
| 38 |
see if SCP is supported. |
| 39 |
} |
| 40 |
\value{ |
| 41 |
Either a raw or character vector giving the contents of the file. |
| 42 |
} |
| 43 |
\references{ |
| 44 |
libcurl \url{https://curl.se/} |
| 45 |
} |
| 46 |
\author{ |
| 47 |
Duncan Temple Lang |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
\seealso{ |
| 52 |
\code{\link{curlPerform}} |
| 53 |
\code{\link{getCurlOptionsConstants}} |
| 54 |
} |
| 55 |
\examples{ |
| 56 |
\dontrun{ |
| 57 |
x = scp("eeyore.ucdavis.edu", "/home/duncan/OmegaWeb/index.html", |
| 58 |
"My.SCP.Passphrase", binary = FALSE) |
| 59 |
x = scp("eeyore.ucdavis.edu", "/home/duncan/OmegaWeb/RCurl/xmlParse.bz2", |
| 60 |
"My.SCP.Passphrase") |
| 61 |
o = memDecompress(x, asChar = TRUE) |
| 62 |
}} |
| 63 |
\keyword{IO} |
| 64 |
\keyword{programming} |