Encode and decode using Base64 representation in macOS.
# To encode a file:
base64 -i <plain_file>
# To decode a file:
base64 -D -i <base64_file>
# To encode from stdin:
echo -n <plain_text> | base64
# To decode from stdin:
echo -n <base64_text> | base64 -D