I’m testing out extracting ZIP files via zlib, but not having any luck. I’m using the following code to extract a ZIP file containing a test image, but it gives the error
Failed to inflate buffer (-3) during
local zip = io.open("./test.zip", "rb") local data = zip:read("a") zip:close() ------------- This part's taken straight from the docs local s = "" for c in string.gmatch(data, ".") do s = s .. "\\" .. string.byte(c) end ------------- local png = io.open("./test.png", "wb") png:write(zlib.inflate(s)) -- Error happens here png:flush() png:close()
Seems like error -3 just means that the given input isn’t the right format. I checked both the ZIP file I want to extract and a test file that’s the output of
zlib.deflate(the png data), and it turns out they’re completely different formats! Neither Archive Utility nor The Unarchiver know how to open it, so I have no idea where to go from here.