String base 64 encode and decode - Node.js String

Node.js examples for String:Base 64

Description

String base 64 encode and decode

Demo Code


String.prototype.base64Encode = function() {
  return (new Buffer(this.valueOf())).toString('base64');
};

String.prototype.base64Decode = function() {
  return (new Buffer(this.valueOf(), 'base64')).toString();
};

Related Tutorials