當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Base64.decode方法代碼示例

本文整理匯總了TypeScript中js-base64.Base64.decode方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Base64.decode方法的具體用法?TypeScript Base64.decode怎麽用?TypeScript Base64.decode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在js-base64.Base64的用法示例。


在下文中一共展示了Base64.decode方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: decodePayload

 static decodePayload (jwt: string): {[key: string]: any} {
   try {
     const payload = jwt.substring(jwt.indexOf('.'), jwt.lastIndexOf('.'))
     return JSON.parse(Base64.decode(payload))
   } catch (err) {
     throw new Error(`Unable to parse JWT token: ${jwt}`)
   }
 }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:8,代碼來源:jwtUtils.ts

示例2: getKubeConfigFromAKS

// get kubeconfig file content
async function getKubeConfigFromAKS(azureSubscriptionEndpoint: string, resourceGroup: string, clusterName: string) : Promise<string> {
    var azureEndpoint: AzureEndpoint = await (new AzureRMEndpoint(azureSubscriptionEndpoint)).getEndpoint();
    var aks = new AzureAksService(azureEndpoint);
    
    tl.debug(tl.loc("KubernetesClusterResourceGroup", clusterName, resourceGroup));

    var clusterInfo : AKSClusterAccessProfile = await aks.getAccessProfile(resourceGroup, clusterName);
    var Base64 = require('js-base64').Base64;
    return Base64.decode(clusterInfo.properties.kubeConfig);
}
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:11,代碼來源:armkubernetescluster.ts

示例3: createKubeconfig

export function createKubeconfig(kubernetesServiceEndpoint: string): string
{
    var kubeconfigTemplateString = '{"apiVersion":"v1","kind":"Config","clusters":[{"cluster":{"certificate-authority-data": null,"server": null}}], "users":[{"user":{"token": null}}]}';
    var kubeconfigTemplate = JSON.parse(kubeconfigTemplateString);

    //populate server url, ca cert and token fields
    kubeconfigTemplate.clusters[0].cluster.server = tl.getEndpointUrl(kubernetesServiceEndpoint, false);
    kubeconfigTemplate.clusters[0].cluster["certificate-authority-data"] = tl.getEndpointAuthorizationParameter(kubernetesServiceEndpoint, 'serviceAccountCertificate', false);
    kubeconfigTemplate.users[0].user.token = Base64.decode(tl.getEndpointAuthorizationParameter(kubernetesServiceEndpoint, 'apiToken', false));

    return JSON.stringify(kubeconfigTemplate);
}
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:12,代碼來源:kubectlutility.ts

示例4: Error

export const getDBIdFromGraphqlId = (
  graphqlId: string,
  schema?: string
): number => {
  // This is temporary solution, we will use slugs in the future
  const rawId = Base64.decode(graphqlId);
  const regexp = /(\w+):(\d+)/;
  const [, expectedSchema, id] = regexp.exec(rawId);
  if (schema && schema !== expectedSchema) {
    throw new Error("Schema is not correct");
  }
  return parseInt(id, 10);
};
開發者ID:p2p-ms,項目名稱:front,代碼行數:13,代碼來源:utils.ts

示例5:

import { Base64 } from 'js-base64'

Base64.encode('dankogai');  // ZGFua29nYWk=
Base64.encode('小飼弾');    // 5bCP6aO85by+
Base64.encodeURI('小飼弾'); // 5bCP6aO85by-

Base64.decode('ZGFua29nYWk=');  // dankogai
Base64.decode('5bCP6aO85by+');  // 小飼弾
// note .decodeURI() is unnecessary since it accepts both flavors
Base64.decode('5bCP6aO85by-');  // 小飼弾
開發者ID:ArtemZag,項目名稱:DefinitelyTyped,代碼行數:10,代碼來源:js-base64-tests.ts

示例6:

import { Base64 } from 'js-base64';

Base64.encode(''); // $ExpectType string
Base64.encode('', true); // $ExpectType string
Base64.encodeURI(''); // $ExpectType string
Base64.decode(''); // $ExpectType string
Base64.atob(''); // $ExpectType string
Base64.btoa(''); // $ExpectType string
Base64.fromBase64(''); // $ExpectType string
Base64.toBase64(''); // $ExpectType string
Base64.toBase64('', true); // $ExpectType string
Base64.btou(''); // $ExpectType string
Base64.utob(''); // $ExpectType string

Base64.noConflict(); // $ExpectType typeof Base64

Base64.extendString(); // $ExpectType void
''.toBase64(); // $ExpectType string
''.toBase64(true); // $ExpectType string
''.toBase64URI(); // $ExpectType string
''.fromBase64(); // $ExpectType string
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:21,代碼來源:js-base64-module.test.ts

示例7: fromBase64String

 public static fromBase64String(base64String: string): string {
   return jsBase64.decode(base64String);
 }
開發者ID:asiddeen,項目名稱:BiB,代碼行數:3,代碼來源:small-functions.ts


注:本文中的js-base64.Base64.decode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。