summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/49_b64enc
blob: 3ef038102aa40b76ea82173fb0ecaca3eacd3c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
The `b64enc()` function encodes the given input string as base64.

Returns a string containing the encoded data.

Returns `null` if the input is not a string.

-- Testcase --
{%
	printf("%.J\n", [
		b64enc("Hello, world!"),
		b64enc("\u0000\u0001\u0002\u0003"),
		b64enc(""),
		b64enc(true)
	]);
%}
-- End --

-- Expect stdout --
[
	"SGVsbG8sIHdvcmxkIQ==",
	"AAECAw==",
	"",
	null
]
-- End --