lib/crypto/index.js
function base64(text, operation) {
  operation = operation || 'encode';
  if (operation === 'decode') {
    return (new Buffer(text, 'base64')).toString();
  } else {
    return (new Buffer(text)).toString('base64');
  }
}
function base64(text, operation) {
  operation = operation || 'encode';
  if (operation === 'decode') {
    return (new Buffer(text, 'base64')).toString();
  } else {
    return (new Buffer(text)).toString('base64');
  }
}
function base64 ( text , operation ) { operation = operation || 'encode' ; if ( operation === 'decode' ) { return ( new Buffer ( text , 'base64' ) ) . toString ( ) ; } else { return ( new Buffer ( text ) ) . toString ( 'base64' ) ; } }
Base64 encode and decode
@function $crypt~base64
@param {string} string  - String to encode or decode
@param {string} [operation=encode] - Operation to perform. Allowed values: 'encode', 'decode'
@returns {string} - Base64 encoded or decoded value
@example
// Encode binary text
$crypt.base64('hello');
// => 'aGVsbG8='
@example
// Decode base64 encoded text
$crypt.base64('aGVsbG8=', 'decode');
// => 'hello'
Base64 encode and decode