authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-09-11 23:58:35 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-09-11 23:58:35 -07:00
logdb738886d5d1d233083c175ebf4aa659f3cf2590
treeb0eea5d212b98874082d5614ee3bb406cedf3026
parent0657e287853475843c27660242e9bbb117374c6b

add base64EncodeAlloc


1 files changed, 6 insertions(+), 0 deletions(-)

src/lib.zig+6
......@@ -48,3 +48,9 @@ pub fn trimPrefix(in: string, prefix: string) string {
4848 }
4949 return in;
5050}
51
52fn base64EncodeAlloc(alloc: *std.mem.Allocator, input: string) !string {
53 const base64 = std.base64.standard_encoder;
54 var buf = try alloc.alloc(u8, base64.calcSize(input.len));
55 return try base64.encode(buf, input);
56}