xAuxEmbed: Function to encode a file as a base64 string for embedding

View source: R/xAuxEmbed.r

xAuxEmbedR Documentation

Function to encode a file as a base64 string for embedding

Description

xAuxEmbed is supposed to encode a file as a base64 string for embedding such as into the R markdown rendering html file. It returns a hyperlink.

Usage

xAuxEmbed(
file,
download.attribute = basename(file),
link.text = paste0("Download ", download.attribute)
)

Arguments

file

a file to encode

download.attribute

the download attribute specifying the target to be downloaded instead of being explored. By default, it is the filename of the input file. The filename of the downloaded file can be different from the input file if provided differently

link.text

the link text (the visible part of the hyperlink)

Value

a hyperlink in the form of: <a href="encoded base64 string" download="download.attribute">"link.text"</a>

Note

This auxiliary function helps embed a file into the R markdown rendering html file for the download.

See Also

xAuxEmbed

Examples

# file <- system.file("DESCRIPTION",package="XGR")
# res <- xAuxEmbed(file)

hfang-bristol/XGR documentation built on Feb. 4, 2023, 7:05 a.m.