A port of the browser's `btoa` function