Skip to contents

Encode and decode using base64

Usage

encode(what, eng = engine())

decode(what, eng = engine())

encode_file(path, eng = engine())

decode_file(path, eng = engine())

Arguments

what

a character, raw, or blob vector

eng

a base64 engine. See engine() for details.

path

a path to a base64 encoded file.

Value

Both encode() and decode() are vectorized. They will return a character and blob vector the same length as what, respectively.

Examples

# encode hello world
encoded <- encode("Hello world")
encoded
#> [1] "SGVsbG8gd29ybGQ="

# decode to a blob
decoded <- decode(encoded)
decoded
#> <blob[1]>
#> [1] blob[11 B]

# convert back to a character
rawToChar(decoded[[1]])
#> [1] "Hello world"