Skip to content

Instantly share code, notes, and snippets.

@s1r-J
Created June 29, 2021 15:42
Show Gist options
  • Save s1r-J/b0ce7e46b159bccd75a205fc49548158 to your computer and use it in GitHub Desktop.
Save s1r-J/b0ce7e46b159bccd75a205fc49548158 to your computer and use it in GitHub Desktop.
import base64url from 'base64url';
function arraybuffer2base64url(ab) {
return base64url.encode(Buffer.from(ab), 'utf8');
}
function base64url2arraybuffer(b64u) {
let buf = base64url.toBuffer(b64u);
return this.buffer2arraybuffer(buf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment