How to extract files from a zip file using Lua?

后端 未结 3 2024
庸人自扰
庸人自扰 2021-01-12 18:24

How do I extract files using Lua?

Update: I now have the following code but it crashes every time it reaches the end of the function, but it successfully extracts al

3条回答
  •  不思量自难忘°
    2021-01-12 18:37

    The "lua-compress-deflatelua" repository on GitHub, by "davidm", implements the Gzip algorithm in plain Lua. Link: https://github.com/davidm/lua-compress-deflatelua (The files are in the lmod directory.)

    Example usage:

    local DEFLATE = require 'compress.deflatelua'
    -- uncompress gzip file
    local fh = assert(io.open('foo.txt.gz', 'rb'))
    local ofh = assert(io.open('foo.txt', 'wb'))
    DEFLATE.gunzip {input=fh, output=ofh}
    fh:close(); ofh:close()
    

提交回复
热议问题