Zig
Zig
HTTP Download from URL with IP Address and Port
See more HTTP Examples
Downloads a file from a URL using an IP address and port.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 assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const http = try chilkat.Http.init();
defer http.deinit();
http.setRequestHeader("Host", "chilkatsoft.com");
const local_file_path = "/temp/hamlet.zip";
http.download("http://107.180.46.206:80/hamlet.zip", local_file_path) catch {
std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
return;
};
std.debug.print("OK!\n", .{});
}