pandoc.zip

Archive

Archive

function pandoc.zip.Archive(bytestring_or_entries: string|pandoc.zip.Entry[])
  -> pandoc.zip.Archive

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.

bytestring

(method) pandoc.zip.Archive:bytestring()

Returns the raw binary string representation of the archive.

extract

(method) pandoc.zip.Archive:extract(options?: table)

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.

Entry

Entry

function pandoc.zip.Entry(path: string, contents: string, modtime?: integer)
  -> pandoc.zip.Entry

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

contents

(method) pandoc.zip.Entry:contents(password?: string)
  -> string

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.

zip

function pandoc.zip.zip(filepaths: string[], options?: table)
  -> pandoc.zip.Archive

Package and compress the given files into a new Archive.