Skip to content

Instantly share code, notes, and snippets.

@tsavola
Created April 7, 2018 11:11
Show Gist options
  • Select an option

  • Save tsavola/877c2c3a04fcbbbf94afc985abab4938 to your computer and use it in GitHub Desktop.

Select an option

Save tsavola/877c2c3a04fcbbbf94afc985abab4938 to your computer and use it in GitHub Desktop.
JavaScript (ES6) oneliner for URL-safe base-64 of arraybuffer contents.
btoa(String.fromCharCode(...new Uint8Array(data))).replace(/\+/g, "-").replace(/\//g, "_")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment