From e95cf5c7b6a08eb560763d5167fbddc1c2117bcc Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 17 Nov 2025 09:57:09 +0100 Subject: add file uploading and multi-threading --- src/routes/api/image/load.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/routes/api/image/load.zig (limited to 'src/routes/api/image/load.zig') diff --git a/src/routes/api/image/load.zig b/src/routes/api/image/load.zig new file mode 100644 index 0000000..1bafb11 --- /dev/null +++ b/src/routes/api/image/load.zig @@ -0,0 +1,14 @@ +const std = @import("std"); +const Context = @import("../../context.zig"); +const Storage = @import("../../../storage/root.zig"); + +pub const access = .users; + +pub fn get(ctx: *Context) ![]const u8 { + const id = ctx.request.head.target["/api/image/load/".len..]; + var image = Storage.Image { .id = id }; + var file = try image.file(ctx.storage); + defer file.close(); + + return try file.readToEndAlloc(ctx.allocator, std.math.maxInt(usize)); +} -- cgit v1.2.3-70-g09d2