/*1* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers2*3* (C) 2010, Nodejitsu Inc.4*5*/67var base64 = exports;89//10// ### function encode (unencoded)11// #### @unencoded {string} The string to base64 encode12// Encodes the specified string to base64 using node.js Buffers.13//14base64.encode = function (unencoded) {15var encoded;1617try {18encoded = new Buffer(unencoded || '').toString('base64');19}20catch (ex) {21return null;22}2324return encoded;25};2627//28// ### function decode (encoded)29// #### @encoded {string} The string to base64 decode30// Decodes the specified string from base64 using node.js Buffers.31//32base64.decode = function (encoded) {33var decoded;3435try {36decoded = new Buffer(encoded || '', 'base64').toString('utf8');37}38catch (ex) {39return null;40}4142return decoded;43};4445