base64. Encoding to Base64

^file.base64[]
^file.base64[options]   [3.4.6]

Method encodes file to Base64 representation. To decode a file from Base64 to it's original, use
^file::base64[encoded].

Options hash can be specified:
·$.wrap(true/false) - return the result with line breaks (by default) or as a single line.  
·$.url-safe(false/true) - use the modified alphabet, with all characters do not need to be converted into %XX in the URL ('-' è '_' are used instead of '+' and '/' ) . Do not use by default.  
·$.pad(true/false) - append padding characters (=), if the coded length is not divisible by 3. Append by default.  

Detailed information on Base64 is available here http://www.ietf.org/rfc/rfc2045.txt
and here http://en.wikipedia.org/wiki/Base64.

Example
$original[^file::load[binary;http://www.parser.ru/i/p2.gif]]
<pre>^original.base64[]</pre>

Outputs…
R0lGODlhCQAJAID/AMDAwAAAACH5BAEAAAAALAAAAAAJAAkAAAINhI8YqXwLQVyMJtscKgA7



Copyright © 1997–2025 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 11.04.2024