class ZFile
😱 Types incomplete or incorrect? 🙏 Please contribute!
methods
ZFile.close
Close a zfile opened by zip.open
.
Example:
local z_file = zip.open('../test.zip')
assert(z_file)
local success = z_file:close()
assert(success == true, success)
Reference:
- Corresponding C source code: luazip.c#L121-L131
ZFile.files
Return an iterator function that returns a new table containing informations about the current file.
Example:
local z_file = zip.open('../test.zip')
assert(z_file)
for info in z_file:files() do
assert(info.filename)
assert(info.compression_method)
assert(info.compressed_size)
assert(info.uncompressed_size)
end
Reference:
- Corresponding C source code: luazip.c#L278-L285
ZFile.open
Open a file that is stored inside the zip file opened by zip.open
.
The filename may contain the full path of the file contained inside the zip. The
directory separator must be '/'.
Unlike f:open
, there is no mode
parameter, as the only
supported mode is "read".
Example:
local z_file = zip.open('test.zip')
assert(z_file)
local _, err = z_file:open('xxx.xxx')
assert(err == 'could not open file `xxx.xxx\'')
local z_internal_file, err = z_file:open('Hello-world.txt')
assert(z_internal_file)
assert(err == nil)
Reference:
- Corresponding C source code: luazip.c#L133-L146