Base64 URL Safe Encoding / Decoding (RFC-7515)
A few days back I was required to encode some string in base 64 URL safe. After some research I found that there are several variants of base 64. The one implemented in the code below corresponds to RFC-7515. Here is the code:
function encodeBase64Url(str) {
let s = new Buffer(