| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/base64.R |
| 3 |
\name{base64_encode} |
| 4 |
\alias{base64_encode} |
| 5 |
\alias{base64_decode} |
| 6 |
\title{Encode/decode data into/from base64 encoding.} |
| 7 |
\usage{ |
| 8 |
base64_encode(x) |
| 9 |
|
| 10 |
base64_decode(x, from = NA) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{x}{For \code{base64_encode()}, a raw vector. If not raw, it is assumed |
| 14 |
to be a file or a connection to be read via \code{readBin()}. For |
| 15 |
\code{base64_decode()}, a string.} |
| 16 |
|
| 17 |
\item{from}{If provided (and \code{x} is not provided), a connection or file |
| 18 |
to be read via \code{readChar()}, and the result will be passed to the |
| 19 |
argument \code{x}.} |
| 20 |
} |
| 21 |
\value{ |
| 22 |
\code{base64_encode()} returns a character string. |
| 23 |
\code{base64_decode()} returns a raw vector. |
| 24 |
} |
| 25 |
\description{ |
| 26 |
The function \code{base64_encode()} encodes a file or a raw vector into the |
| 27 |
base64 encoding. The function \code{base64_decode()} decodes data from the |
| 28 |
base64 encoding. |
| 29 |
} |
| 30 |
\examples{ |
| 31 |
xfun::base64_encode(as.raw(1:10)) |
| 32 |
logo = xfun:::R_logo() |
| 33 |
xfun::base64_encode(logo) |
| 34 |
xfun::base64_decode("AQIDBAUGBwgJCg==") |
| 35 |
} |