How to use the base64-js.decode function in base64-js

To help you get started, we’ve selected a few base64-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SocketCluster / socketcluster-client / socketcluster.js View on Github external
SCSocket.prototype.decodeBase64 = function (encodedString) {
  var decodedString;
  if (typeof Buffer == 'undefined') {
    if (global.atob) {
      decodedString = global.atob(encodedString);
    } else {
      decodedString = base64.decode(encodedString);
  } else {
    var buffer = new Buffer(encodedString, 'base64');
    decodedString = buffer.toString('utf8');
  return decodedString;


Base64 encoding/decoding in pure JS

Latest version published 4 years ago

Package Health Score

74 / 100
Full package analysis