NAME
std/string/base64 - Base64 encoders and decoders.
SYNOPSIS
from std/string/base64 import *;
let raw := to_binary( "Hello, world!" );
let b64 := encode(raw);
let text := decode(b64);
let safe := encode_urlsafe(raw);
let original := decode_urlsafe(safe);
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
This module provides Base64 encoding and decoding helpers.
The URL-safe variant uses - and _ instead of + and /. It also omits trailing = padding so encoded text can be placed into URLs more easily.
EXPORTS
Functions
encode(BinaryString value)Parameters:
valueis binary input data. Returns:String. Encodesvalueas standard Base64 text.decode(String value)Parameters:
valueis standard Base64 text. Returns:BinaryString. Decodes Base64 text into bytes.encode_urlsafe(BinaryString value)Parameters:
valueis binary input data. Returns:String. Encodesvalueas URL-safe Base64 text without trailing padding.decode_urlsafe(String value)Parameters:
valueis URL-safe Base64 text. Returns:BinaryString. Decodes URL-safe Base64 text, adding missing trailing padding automatically.
COPYRIGHT AND LICENCE
std/string/base64 is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.