src/helper.js
function b64encode(str) {
    const buf = Buffer.isBuffer(str) ? str : Buffer.from(str);
    return b64escape(buf.toString('base64'));
}
function b64encode(str) {
    const buf = Buffer.isBuffer(str) ? str : Buffer.from(str);
    return b64escape(buf.toString('base64'));
}
function b64encode ( str ) { const buf = Buffer . isBuffer ( str ) ? str : Buffer . from ( str ) ; return b64escape ( buf . toString ( 'base64' ) ) ; }
Base64 encode and escape buffer or string

@param {buffer|string} str Buffer or string to be encoded
@returns {string} Escaped base64 encoded string
Base64 encode and escape buffer or string