diff options
Diffstat (limited to 'src/routes/api')
| -rw-r--r-- | src/routes/api/image/load.zig | 7 |
1 files changed, 2 insertions, 5 deletions
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)); } |