From 6201307fecf8398a1b53bf276bc08bfbb3524899 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 17 Nov 2025 13:09:02 +0100 Subject: implement memora.Stream --- src/routes/api/image/load.zig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/routes/api') diff --git a/src/routes/api/image/load.zig b/src/routes/api/image/load.zig index 51c0e26..4f0a072 100644 --- a/src/routes/api/image/load.zig +++ b/src/routes/api/image/load.zig @@ -6,11 +6,8 @@ const Storage = memora.Storage; pub const access = .users; -pub fn get(ctx: *Context) ![]const u8 { +pub fn get(ctx: *Context) !memora.Stream { 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)); + return .from_file(try image.file(ctx.storage)); } -- cgit v1.2.3-70-g09d2