From: patrick-scho Date: Sat, 10 Aug 2024 15:23:35 +0000 (+0200) Subject: add decompress X-Git-Url: https://gitweb.ps.run/ziggit/commitdiff_plain/93ee72996f9dd80ef2a867a96b207e78a4aad7a2 add decompress --- diff --git a/git.zig b/git.zig index e21847c..d228b50 100644 --- a/git.zig +++ b/git.zig @@ -30,6 +30,14 @@ const Object = struct { // pub fn getBlob(self: *Object) Blob {} }; +fn decompress(alloc: Alloc, r: Reader) ![]u8 { + var buffer = std.ArrayList(u8).init(alloc); + + try std.compress.zlib.decompress(r, buffer.writer().any()); + + return alloc.realloc(buffer.allocatedSlice(), buffer.items.len); +} + const PackFile = struct { alloc: Alloc, idxFile: std.fs.File,