How to use the base-64.decode function in base-64

To help you get started, we’ve selected a few base-64 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 liamray / nexl-js / tests / basic-auth-tests / basic-auth-tests.js View on Github external
function decode(auth) {
	try {
		return base64.decode(auth.substr(6));
	} catch (e) {
		return auth;
	}
}
github FHIR / auto-ig-builder / triggers / deployment-trigger / index.js View on Github external
var secret = require('./secret.json');
var decode = require('base-64').decode;
var Api = require('kubernetes-client');

var config = {
  url: 'https://' + secret.clusterIp,
  ca: decode(secret.data['ca.crt']),
  auth: {
    bearer: decode(secret.data.token)
  }
};

const core = new Api.Core(config);

exports['container-deploy-trigger'] = function helloPubSub (event, callback) {
  console.log("called!");
  const pubsubMessage = event.data;
  const result = JSON.parse(Buffer.from(pubsubMessage.data, 'base64').toString());
  console.log("result", result);

  if (result.status !== 'SUCCESS'){
    return callback();
  }
github wkh237 / react-native-fetch-be00a2490802cc57029bde7a5538e6a97517fd23 / index.js View on Github external
this.json = ():any => {
      switch(this.type) {
        case 'base64':
          return JSON.parse(base64.decode(this.data))
        case 'path':
          return fs.readFile(this.data, 'utf8')
                   .then((text) => Promise.resolve(JSON.parse(text)))
        default:
          return JSON.parse(this.data)
      }
    }
    /**
github josiahg / cloudbreak-cuisine / frontend / src / views / Profiles / AddProfile.js View on Github external
<i></i>
                            
                            <input disabled="" placeholder="Enter URL" name="recipeURL" id="recipeURL" type="text">
                          
                        
                        
                          
                            
                              <i></i>
                            
                            <input required="" value="{Base64.decode(this.state.file)}" placeholder="Enter profile file code" name="recipeCode" id="recipeCode" type="textarea">
                          
                        
                      

                    
                  
                  

                    
                      &nbsp;
   
                    
                      <button href="#/profiles" color="primary" size="lg">
                        <i></i> Back
                            </button>
                      &nbsp;
github enkidevs / approve-ci / src / approval.js View on Github external
export function mergeConfigs (remoteConfig) {
  const config = defaultConfig
  if (remoteConfig && remoteConfig.content) {
    var userConfig = JSON.parse(decode(remoteConfig.content))
    Object.keys(userConfig).forEach((key) => {
      if (Array.isArray(userConfig[key])) {
        config[key] = userConfig[key].map((item) => decodeURIComponent(item))
      } else if (typeof userConfig[key] === 'string') {
        config[key] = decodeURIComponent(userConfig[key])
      } else {
        config[key] = userConfig[key]
      }
    })
  }
  return config
}
github pizn / eevee / src / services / repo.js View on Github external
const b64decode = (string) => {
  const base64Decode = require('base-64').decode;
  const utf8Decode = require('utf8').decode;
  return utf8Decode(base64Decode(string));
};
github remobile / react-native-template / project / App / node_modules / react-native-fs / FS.common.js View on Github external
return command(normalizeFilePath(filepath)).then((b64) => {
    var contents;

    if (options.encoding === 'utf8') {
      contents = utf8.decode(base64.decode(b64));
    } else if (options.encoding === 'ascii') {
      contents = base64.decode(b64);
    } else if (options.encoding === 'base64') {
      contents = b64;
    } else {
      throw new Error('Invalid encoding type "' + String(options.encoding) + '"');
    }

    return contents;
  });
}

base-64

A robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, written in JavaScript.

MIT
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis