Zig
Zig
Open and Unzip an AES Encrypted Zip
See more Zip Examples
Open and unzip an AES encrypted Zip.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const zip = try chilkat.Zip.init();
defer zip.deinit();
zip.openZip("/myZips/aes.zip") catch {
std.debug.print("{s}\n", .{try zip.getLastErrorText(alloc)});
return;
};
// Set the password needed to unzip.
// This password must match the password used when the zip
// was created.
zip.setDecryptPassword("myPassword");
// Unzip the .zip into /unzipDir.
// Returns the number of files and directories unzipped.
const unzip_count = zip.unzip("/unzipDir/");
if (unzip_count < 0) {
std.debug.print("{s}\n", .{try zip.getLastErrorText(alloc)});
} else {
std.debug.print("Success!\n", .{});
}
}