src/encoding/base64.js
function r2s(t, u) {
  // TODO check atob alternative
  let c;

  let s = 0;
  let a = 0;

  return stream.transform(t, value => {
    const tl = value.length;
    const r = new Uint8Array(Math.ceil(0.75 * tl));
    let index = 0;
    for (let n = 0; n < tl; n++) {
      c = b64toByte[value.charCodeAt(n)];
      if (c >= 0) {
        if (s) {
          r[index++] = a | ((c >> (6 - s)) & 255);
        }
        s = (s + 2) & 7;
        a = (c << s) & 255;
      }
    }
    return r.subarray(0, index);
  });
}
function r2s(t, u) {
  // TODO check atob alternative
  let c;

  let s = 0;
  let a = 0;

  return stream.transform(t, value => {
    const tl = value.length;
    const r = new Uint8Array(Math.ceil(0.75 * tl));
    let index = 0;
    for (let n = 0; n < tl; n++) {
      c = b64toByte[value.charCodeAt(n)];
      if (c >= 0) {
        if (s) {
          r[index++] = a | ((c >> (6 - s)) & 255);
        }
        s = (s + 2) & 7;
        a = (c << s) & 255;
      }
    }
    return r.subarray(0, index);
  });
}
function r2s ( t , u ) { // TODO check atob alternative let c ; let s = 0 ; let a = 0 ; return stream . transform ( t , value => { const tl = value . length ; const r = new Uint8Array ( Math . ceil ( 0.75 * tl ) ) ; let index = 0 ; for ( let n = 0 ; n < tl ; n ++ ) { c = b64toByte [ value . charCodeAt ( n ) ] ; if ( c >= 0 ) { if ( s ) { r [ index ++ ] = a | ( ( c >> ( 6 - s ) ) & 255 ) ; } s = ( s + 2 ) & 7 ; a = ( c << s ) & 255 ; } } return r . subarray ( 0 , index ) ; } ) ; }
Convert radix-64 to binary array
@param {String | ReadableStream<String>} t radix-64 string to convert
@param {bool} u if true, input is interpreted as URL-safe
@returns {Uint8Array | ReadableStream<Uint8Array>} binary array version of input string
@static
Convert radix - 64 to binary array