code: function convertToBase64(input) {
          var result = "";
          var charCodes = getExpandedCharCodes(input);
          var i = 0;
          var length = charCodes.length;
          var byte1, byte2, byte3, byte4;
          while (i < length) {
              // Convert every 6-bits in the input 3 character points
              // into a base64 digit
              byte1 = charCodes[i] >> 2;
              byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;
              byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;
              byte4 = charCodes[i + 2] & 63;
              // We are out of characters in the input, set the extra
              // digits to 64 (padding character).
              if (i + 1 >= length) {
                  byte3 = byte4 = 64;
              }
              else if (i + 2 >= length) {
                  byte4 = 64;
              }
              // Write to the output
              result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
              i += 3;
          }
          return result;
      }
docs: Converts a string to a base-64 encoded ASCII string.