authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-30 01:47:39 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-30 01:47:39 -07:00
log512638d169b5fb13b4ac023b03f20c777a42f38f
tree119b12e0385e5add92c9122859a3711fce229fd1
parent0123f5c26d5f18bd0a1bb05151b40bb9c46de54d

add base64DecodeAlloc


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

src/lib.zig+7
......@@ -69,6 +69,13 @@ pub fn base64EncodeAlloc(alloc: std.mem.Allocator, input: string) !string {
6969 return base64.encode(buf, input);
7070}
7171
72pub fn base64DecodeAlloc(alloc: std.mem.Allocator, input: string) !string {
73 const base64 = std.base64.standard.Decoder;
74 var buf = try alloc.alloc(u8, try base64.calcSizeForSlice(input));
75 try base64.decode(buf, input);
76 return buf;
77}
78
7279pub fn asciiUpper(alloc: std.mem.Allocator, input: string) ![]u8 {
7380 var buf = try alloc.dupe(u8, input);
7481 for (0..buf.len) |i| {