Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

base64_encode

Encode/decode data into/from base64 encoding.


Description

The function base64_encode() encodes a file or a raw vector into the base64 encoding. The function base64_decode() decodes data from the base64 encoding.

Usage

base64_encode(x)

base64_decode(x, from = NA)

Arguments

x

For base64_encode(), a raw vector. If not raw, it is assumed to be a file or a connection to be read via readBin(). For base64_decode(), a string.

from

If provided (and x is not provided), a connection or file to be read via readChar(), and the result will be passed to the argument x.

Value

base64_encode() returns a character string. base64_decode() returns a raw vector.

Examples

xfun::base64_encode(as.raw(1:10))
logo = xfun:::R_logo()
xfun::base64_encode(logo)
xfun::base64_decode("AQIDBAUGBwgJCg==")

xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.