1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
\name{sha_url}
\alias{sha_url}
\title{Download a file from a URL and find a SHA-1 hash of it}
\usage{
sha_url(url, cmd = TRUE)
}
\arguments{
\item{url}{The URL of the file to find a hash of.}
\item{cmd}{If \code{TRUE} (the default), print out a
command for sourcing the URL with
\code{\link{source_url}()}, including the hash.}
}
\description{
This will download a file and find a SHA-1 hash of it,
using \code{\link{digest}()}. The primary purpose of this
function is to provide an easy way to find the value of
\code{sha} which can be passed to
\code{\link{source_url}()}.
}
\examples{
\dontrun{
# Get the SHA hash of a file. It will print the text below and return
# the hash as a string
sha_url("https://gist.github.com/wch/dae7c106ee99fe1fdfe7/raw/db0c9bfe0de85d15c60b0b9bf22403c0f5e1fb15/test.r")
# Command for sourcing the URL:
# downloader::source_url("https://gist.github.com/wch/dae7c106ee99fe1fdfe7/raw/db0c9bfe0de85d15c60b0b9bf22403c0f5e1fb15/test.r", sha="9b8ff5213e32a871d6cb95cce0bed35c53307f61")
# [1] "9b8ff5213e32a871d6cb95cce0bed35c53307f61"
}
}
|