How to extract files from a zip file using Lua?

后端 未结 3 2047
庸人自扰
庸人自扰 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条回答
  •  猫巷女王i
    2021-01-12 18:44

    Short Answer:

    LuaZip is a lightweight Lua extension library used to read files stored inside zip files. The API is very similar to the standard Lua I/O library API.

    Use LuaZip to read files from the archive and then write them to the filesystem using the Lua io module. If you require filesystem operations not supported by ANSI C, then take a look at LuaFileSystem. LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution. LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.


    Further reading:

    LAR is a virtual file system for Lua using ZIP compression.

    If you need to read gzip streams or gzipped tar files then take a look at gzio. The Lua gzip file I/O module emulates the standard I/O module, but operates on compressed gzip format files.

提交回复
热议问题