Convert Text to Base64
Verb: textToBase64
Converts text to Base64 format.
Base64 encoding is a process for converting binary data to an ASCII string format. The binary data is converted into a 6-bit character representation.
Syntax
textToBase64 --source(String) --encoding(Nullable<EncodingType>) (Boolean)=success (String)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --source | Text | Required | Text | Text that should be encoded to Base64 format. |
| --encoding | Encoding | Required | EncodingType | Type of encoding used to convert the text to Base64. Options:
|
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| success | Success | Boolean | Returns True if the conversion was successful, or False if it was not. |
| value | Base 64 | Text | Text converted to Base64 format. |
Example
Converts the inserted text to Base 64 format.
defVar --name success --type Boolean
defVar --name base64Content --type String
defVar --name convertedText --type String --value "This is a text that will be base64 encoded"
// Convert the text contained in "${convertedText}" to base 64 format using UTF8.
textToBase64 --source "${convertedText}" --encoding "UTF8" success=success base64Content=value
logMessage --message "Success: ${success}\r\nText converted to Base64: ${base64Content}" --type "Info"
// Result: True
// Text converted to Base64: VGhpcyBpcyBhIHRleHQgdGhhdCB3aWxsIGJlIGJhc2U2NCBlbmNvZGVk