Expand/Shrink

encode_base64

Definition: string res = encode_base64(sequence src, integer wrap_column=0)
Description: Convert data to a base64 encoded string.

src: a (binary) string or sequence of (integer) bytes #0..#FF, ie no float/string/sequence elements.
wrap_column: If non-zero, "\r\n" is inserted between every wrap_column bytes.
pwa/p2js: Supported.
Notes: The result should be broken into lines of no more than 76 characters before transmission, according to RFC 2045
(Base64 transfer encoding for MIME), and in most cases specifying a wrap_column of 76 does exactly what is needed.
Equivalently, the input could theoretically be broken into chunks of 57 bytes, before being passed to this routine, though
in truth I only really mention that to help in understanding of the ratios between input and output sizes (57 = 19*3, 76 = 19*4).
Implementation: See builtins\base64.e (an autoinclude)
See Also: decode_base64