Zig
Zig
Decode Base64
Demonstrates how to decode base64.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
const bd = try chilkat.BinData.init();
defer bd.deinit();
// Append a base64 string to bd.
try bd.appendEncoded("c2VjcmV0", "base64");
// The bd now contains the decoded bytes.
// Let's say it was a password string..
const password = try bd.getString(alloc, "utf-8");
// Decodes to "secret".
std.debug.print("password = {s}\n", .{password});
}