hslua-module-zip: Lua module to work with file zips.

[ foreign, library, mit ] [ Propose Tags ]

Module with function for creating, modifying, and extracting files from zip archives.

[Skip to Readme]


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 1.0.0, 1.1.0, 1.1.1
Change log CHANGELOG.md
Dependencies base (>=4.11 && <5), bytestring, filepath (>=1.4 && <1.6), hslua-core (>=2.3 && <2.4), hslua-list (>=1.1 && <1.2), hslua-marshalling (>=2.3 && <2.4), hslua-packaging (>=2.3 && <2.4), hslua-typing (>=0.1 && <0.2), text (>=1.2 && <2.2), time (>=1.5 && <1.14), zip-archive (>=0.4 && <0.5) [details]
License MIT
Copyright © 2020-2024 Albert Krewinkel
Author Albert Krewinkel
Maintainer Albert Krewinkel <tarleb@hslua.org>
Category Foreign
Home page https://hslua.org/
Bug tracker https://github.com/hslua/hslua/issues
Source repo head: git clone https://github.com/hslua/hslua(hslua-module-zip)
Uploaded by tarleb at 2024-01-18T17:35:35Z
Distributions Arch:1.1.1, Fedora:1.1.0, LTSHaskell:1.1.1, NixOS:1.1.1, Stackage:1.1.1, openSUSE:1.1.1
Reverse Dependencies 1 direct, 1 indirect [details]
Downloads 2669 total (149 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-01-18 [all 1 reports]

Readme for hslua-module-zip-1.1.1

[back to package description]


GitHub CI Hackage Stackage Lts Stackage Nightly MIT license

Lua module to work with file zips.


Functions to create, modify, and extract files from zip archives.

The module can be called as a function, in which case it behaves like the zip function described below.

Zip options are optional; when defined, they must be a table with any of the following keys:

  • recursive: recurse directories when set to true;
  • verbose: print info messages to stdout;
  • destination: the value specifies the directory in which to extract;
  • location: value is used as path name, defining where files are placed.
  • preserve_symlinks: Boolean value, controlling whether symbolic links are preserved as such. This option is ignored on Windows.



Archive (bytestring_or_entries)

Reads an Archive structure from a raw zip archive or a list of Entry items; throws an error if the given string cannot be decoded into an archive.

Since: 1.0.0


bytestring_or_entries : (string|{ZipEntry,...})


  • (ZipArchive)


Entry (path, contents[, modtime])

Generates a zip Entry from a filepath, the file's uncompressed content, and the file's modification time.

Since: 1.0.0


path : file path in archive (string)

contents : uncompressed contents (string)

modtime : modification time (integer)


read_entry (filepath, opts)

Generates a ZipEntry from a file or directory.

Since: 1.0.0


filepath : (string)

opts : zip options (table)


  • a new zip archive entry (ZipEntry)


zip (filepaths[, options])

Package and compress the given files into a new Archive.

Since: 1.0.0


filepaths : list of files from which the archive is created. ({string,...})

options : zip options (table)


  • a new archive (ZipArchive)



A zip archive with file entries.


entries : files in this zip archive ({Entry,...})


extract([opts]) : Extract all files from this archive, creating directories as needed. Note that the last-modified time is set correctly only in POSIX, not in Windows. This function fails if encrypted entries are present.

Use `archive:extract{destination = 'dir'}` to extract to
subdirectory `dir`.

bytestring() : Returns the raw binary string representation of the archive.


File or directory entry in a zip archive.


path : relative path, using / as separator

modtime : modification time (seconds since unix epoch)


contents([password]) : Get the uncompressed contents of a zip entry. If password is given, then that password is used to decrypt the contents. An error is throws if decrypting fails.