base64.encode
base64.encode
Function
Encode the text stored in base64(text) into a Base64 string.
Syntax
base64(text).encode(mode)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| mode | Int | No | 0 | Coding table: 0 BASE64_STANDARD, 1 BASE64_STANDARD_NO_PAD, 2 BASE64_URL_SAFE, 3 BASE64_URL_SAFE_NO_PAD. |
Return value
| Type | Description |
|---|---|
| String | Returns the encoded Base64 string. |
Example
result = base64('BT').encode() // Output: QlQ= print result
Notes
- Input text is encoded in UTF-8 bytes.