Package 'base64'

Title: Base64 Encoder and Decoder
Description: Compatibility wrapper to replace the orphaned package. New applications should use base64 encoders from 'jsonlite' or 'openssl' or 'base64enc'.
Authors: Jeroen Ooms [aut, cre]
Maintainer: Jeroen Ooms <[email protected]>
License: MIT + file LICENSE
Version: 2.0.2
Built: 2024-11-02 05:42:50 UTC
Source: https://github.com/jeroen/base64

Help Index


Encode and Decode base64

Description

Wrapper for openssl::base64_encode.

Usage

encode(input, output = tempfile(), linebreaks = TRUE)

decode(input, output = tempfile())

Arguments

input

input file

output

output file

linebreaks

insert linebreaks to make output human readable See openssl::base64_encode

Examples

# encode a file
myfile <- R.home("COPYING")
tmp <- tempfile()
base64::encode(myfile, tmp)

# decode it back
orig <- tempfile()
base64::decode(tmp, orig)
readLines(orig)

Encode a png file as a img data uri

Description

This creates html code to embed a png file into an html document. image

Usage

img(file, Rd = FALSE, alt = "image")

Arguments

file

png file to translate into a data uri

Rd

if TRUE, extra markup is added to facilitate inclusion of the image in an Rd file

alt

alternate text

Examples

pngfile <- tempfile()
png(pngfile, width = 600, height = 400)
plot(1:100, rnorm(100), pch = 21, bg = "red", cex = 2 )
dev.off()
img(pngfile, Rd = TRUE)