category export class UnpaddedBase64 { private constructor ( ) { } param { Buffer } buf returns { string } public static encodeBuffer ( buf ) { return buf . toString ( 'base64' ) . replace ( /[=]*$/g , '' ) ; } param { string } str returns { string } public static encodeString ( str ) { return UnpaddedBase64 . encodeBuffer ( new Buffer ( str ) ) ; } param { Buffer } buf returns { string } public static encodeBufferUrlSafe ( buf ) { return UnpaddedBase64 . encodeBuffer ( buf ) . replace ( /\+/g , '-' ) . replace ( /\//g , '_' ) ; } param { string } str returns { string } public static encodeStringUrlSafe ( str ) { return UnpaddedBase64 . encodeBufferUrlSafe ( new Buffer ( str ) ) ; } }