| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/paths.R |
| 3 |
\name{url_filename} |
| 4 |
\alias{url_filename} |
| 5 |
\title{Extract filenames from a URLs} |
| 6 |
\usage{ |
| 7 |
url_filename(x, default = "index.html") |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{A character vector of URLs.} |
| 11 |
|
| 12 |
\item{default}{The default filename when it cannot be determined from the |
| 13 |
URL, e.g., when the URL ends with a slash.} |
| 14 |
} |
| 15 |
\value{ |
| 16 |
A character vector of filenames at the end of URLs. |
| 17 |
} |
| 18 |
\description{ |
| 19 |
Get the base names of URLs via \code{\link[=basename]{basename()}}, and remove the |
| 20 |
possible query parameters or hash from the names. |
| 21 |
} |
| 22 |
\examples{ |
| 23 |
xfun::url_filename("https://yihui.org/images/logo.png") |
| 24 |
xfun::url_filename("https://yihui.org/index.html") |
| 25 |
xfun::url_filename("https://yihui.org/index.html?foo=bar") |
| 26 |
xfun::url_filename("https://yihui.org/index.html#about") |
| 27 |
xfun::url_filename("https://yihui.org") |
| 28 |
xfun::url_filename("https://yihui.org/") |
| 29 |
} |