Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@konsumer
Last active January 29, 2022 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konsumer/eff429df0278ac7ef5aacf1717059abe to your computer and use it in GitHub Desktop.
Save konsumer/eff429df0278ac7ef5aacf1717059abe to your computer and use it in GitHub Desktop.
Node implementation for btoa/atob to do base64 like in the browser/cloudflare-worker.
if (typeof atob === 'undefined') {
var atob = a => new Buffer(a).toString('base64')
}
if (typeof btoa === 'undefined') {
var btoa = a => Buffer.from(a, 'base64').toString('utf8')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment