base64(data) Last updated: 22. Jun 2023

Converts data to base64 encoded string.

Parameters

Name Type Description
data string or byte[] Data to encode with base64 encoding.

If string it is converted to UTF8 bytes first before encoding.

Returns

Base64 encoded string.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
let bytes = [1, 2, 3];

write(base64(bytes));

Output

The JS code above produces the output shown below:
WzEsMiwzXQ==