This is based wholly on the work by good folks at the MDN.
See https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
License
=======
Mozilla has licensed this code in the Public Domain, which means that I am at liberty to re-license my copy under the Apache 2, which is something that, general speaking, your legal department will feel more comfortable with.