Functions

fromBase64

fromBase64(String): Binary

Converts a base64 string representation into a binary

For an example, see toBase64.

fromHex

fromHex(String): Binary

Converts an hexadecimal string representation into a binary

Transform
1
2
3
4
5
%dw 2.0
import * from dw::core::Binaries
output application/json
---
{ "binary": fromHex('4D756C65')}
Output
{
  "binary": "Mule"
}

toBase64

toBase64(Binary): String

Transforms the specified binary into the base64 string representation

Transform
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
%dw 2.0
import * from dw::core::Binaries
output application/json
---
 toBase64(fromBase64(12463730))
 ----

 .Output
 ----
 12463730
 ----


=== toHex

==== toHex(Binary): String

Converts the specified binary into the hexadecimal String representation

.Transform
[source,DataWeave, linenums]

%dw 2.0 import * from dw::core::Binaries output application/json --- { "hex" : toHex('Mule') }

.Output

{ "hex": "4D756C65" }