How to use the js-base64.Base64.btoa function in js-base64

To help you get started, we’ve selected a few js-base64 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 expo / expo / packages / expo-bluetooth-utils / build / Bluetooth.js View on Github external
export function encodeBinaryString(str) {
    // first we use encodeURIComponent to get percent-encoded UTF-8,
    // then we convert the percent encodings into raw bytes which
    // can be fed into btoa.
    const input = encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (m, p) => `0x${p}`);
    return Base64.btoa(input);
}
/*
github expo / expo / packages / expo-bluetooth-utils / src / Bluetooth.ts View on Github external
export function encodeBinaryString(str: string): string {
  // first we use encodeURIComponent to get percent-encoded UTF-8,
  // then we convert the percent encodings into raw bytes which
  // can be fed into btoa.
  const input = encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (m, p) => `0x${p}`);
  return Base64.btoa(input);
}
github cancerberoSgx / univac / svg-png-converter / src / base64.ts View on Github external
export function isBase64(str: string) {
  if (str === '' || str.trim() === '') { return false }
  try {
    return Base64.btoa(Base64.atob(str)) == str
  } catch (err) {
    return false
  }
}
github expo / expo / apps / native-component-list / src / screens / Bluetooth / BluetoothPeripheralScreen.tsx View on Github external
const JSONToNative = value => {
  const input = encodeURIComponent(value).replace(/%([0-9A-F]{2})/g, (m, p) => `0x${p}`);
  return Base64.btoa(input);
};
const nativeToJSON = value => {
github hostmakerco / zendesk-node-sdk / lib / api / auth.js View on Github external
function createAuthorizationHeaderValue(config) {
  const {
    authType, email, password, zendeskAdminToken,
  } = config;

  switch (authType) {
    case AUTH_TYPES.BASIC_AUTH:
      return `Basic ${Base64.btoa(`${email}:${password}`)}`;
    case AUTH_TYPES.API_TOKEN:
      return `Basic ${Base64.btoa(`${email}/token:${zendeskAdminToken}`)}`;
    case AUTH_TYPES.API_TOKEN_BASE64_ENCODED:
      return `Basic ${zendeskAdminToken}`;
    default:
    case AUTH_TYPES.OAUTH_ACCESS_TOKEN:
      return `Bearer ${zendeskAdminToken}`;
  }
}
github ailabstw / pttai.js / src / reducers / ServerUtils.js View on Github external
export const b64encodeByte = (str) => {
  return Base64.btoa(str)
}
github expo / expo / packages / expo-firebase-firestore / src / Blob.ts View on Github external
toBase64(): string {
    return Base64.btoa(this._binaryString);
  }