Skip to content

decodeBase64 - Decode a base64 string

decodeBase64 will transform a Base64 encoded string back into its original value.

Syntax

decodeBase64(value: string): string

Arguments

NameTypeRequiredDescription
valuestringtrueThe base64 encoded string to be decoded

Example - Decoding base64 encoded URLs

It's common to send data that contains special or reserved characters, like URLs, in Base64 encoded format, to ensure there are no parsing issues.

{
    path: "/home",
    domain: "coralogix.com",
    full_url_encoded: "aHR0cHM6Ly9jb3JhbG9naXguY29tL2hvbWU=" 
}

If we want to view the original full_url value, we can use decodeBase64:

create full_url from decodeBase64(full_url_encoded)

The resulting document will look like this:

{
    path: "/home",
    domain: "coralogix.com",
    full_url_encoded: "aHR0cHM6Ly9jb3JhbG9naXguY29tL2hvbWU=",
    full_url: "https://coralogix.com/home"
}

An alternative way to write this function is as follows:

create full_url from full_url_encoded.decodeBase64()