lib/mime.js
function( input, charset ) {
    if( charset && !Buffer.isBuffer( input ) ) {
      return MIME.Iconv.encode( input, charset )
    } else {
      return Buffer.isBuffer( input )
        ? input.toString( 'base64' )
        : Buffer.from( input ).toString( 'base64' )
    }
  }
function( input, charset ) {
    if( charset && !Buffer.isBuffer( input ) ) {
      return MIME.Iconv.encode( input, charset )
    } else {
      return Buffer.isBuffer( input )
        ? input.toString( 'base64' )
        : Buffer.from( input ).toString( 'base64' )
    }
  }
function ( input , charset ) { if ( charset && ! Buffer . isBuffer ( input ) ) { return MIME . Iconv . encode ( input , charset ) } else { return Buffer . isBuffer ( input ) ? input . toString ( 'base64' ) : Buffer . from ( input ) . toString ( 'base64' ) } }
Base64 encodes a buffer or string.

@param  {String|Buffer} input
@param  {String} charset
@return {String}
Base64 encodes a buffer or string .