'\" '\" Copyright (c) 2015 Jan Nijtmans '\" Copyright (c) 2015-2018 Christian Werner '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH zipfs n 1.0 Zipfs "zipfs Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME zipfs \- Mount and work with ZIP files within Tcl .SH SYNOPSIS .nf \fBpackage require zipfs \fR?\fB1.0\fR? .sp \fBzipfs::exists\fR \fIfilename\fR \fBzipfs::find\fR \fIdir\fR \fBzipfs::info\fR \fIfilename\fR \fBzipfs::list\fR \fB?(-glob|-regexp)?\fR \fI?pattern?\fR \fBzipfs::lmkimg\fR \fIoutfile\fR \fIinlist\fR \fI?password?\fR \fI?infile?\fR \fBzipfs::lmkzip\fR \fIoutfile\fR \fIinlist\fR \fI?password?\fR \fBzipfs::mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR \fBzipfs::mkkey\fR \fIpassword\fR \fBzipfs::mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fBzipfs::mount\fR \fI?zipfile\fR \fI?mountpoint?\fR \fI?password?\fR \fBzipfs::unmount\fR \fIzipfile\fR .fi .BE .SH DESCRIPTION .PP The \fBzipfs\fR package provides tcl with the ability to mount the contents of a ZIP file as a virtual file system. .TP \fBzipfs::exists\fR \fIfilename\fR . Return 1 if the given filename exists in the mounted zipfs and 0 if it does not. .TP \fBzipfs::find\fR \fIdir\fR . Recursively lists files including and below the directory \fIdir\fR. The result list consists of relative path names starting from the given directory. This command is also used by the \fBzipfs::mkzip\fR and \fBzipfs::mkimg\fR commands. .TP \fBzipfs::info\fR \fIfile\fR . Return information about the given file in the mounted zipfs. The information consists of (1) the name of the ZIP archive file that contains the file, (2) the size of the file after decompressions, (3) the compressed size of the file, and (4) the offset of the compressed data in the ZIP archive file. .RS .PP Note: querying the mount point gives the start of ZIP data offset in (4), which can be used to truncate the ZIP info off an executable. .PP Note: the file of a mounted ZIP archive appears as directory but can be opened and read like a regular file if the mount process detected a non archive area in front of the ZIP archive, e.g. when the ZIP archive was appended to an executable file. In this case that area can be read using the Tcl \fBopen\fR and \fBread\fR commands but \fBfile copy\fR treats the mounted archive as a directory. .RE .TP \fBzipfs::list\fR \fB?(-glob|-regexp)?\fR \fI?pattern?\fR . Return a list of all files in the mounted zipfs. The order of the names in the list is arbitrary. .TP \fBzipfs::lmkimg\fR \fIoutfile\fR \fIinlist\fR \fI?password?\fR \fI?infile?\fR Like \fBzipfs::mkimg\fR but instead of an input directory \fIinlist\fR must be a list where the odd elements are the original input file names as copied into the archive and the even elements their respective names within the archive. .TP \fBzipfs::lmkzip\fR \fIoutfile\fR \fIinlist\fR \fI?password?\fR . Like \fBzipfs::mkzip\fR but instead of an input directory \fIinlist\fR must be a list where the odd elements are the original input file names as copied into the archive and the even elements their respective names within the archive. .TP \fBzipfs::mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR . Creates an image (potentially a new executable file) similar to \fBzipfs::mkzip\fR. If the \fIinfile\fR parameter is specified, this file is prepended in front of the ZIP archive, otherwise the file returned by \fBTcl_NameOfExecutable(3)\fR (i.e. the executable file of the running process) is used. If the \fIpassword\fR parameter is not empty, an obfuscated version of that password is placed between the image and ZIP chunks of the output file and the contents of the ZIP chunk are protected with that password. .RS .PP Caution: highly experimental, not usable on Android, only partially tested on Linux and Windows. .RE .TP \fBzipfs::mkkey\fR \fIpassword\fR . For the clear text \fIpassword\fR argument an obfuscated string version is returned with the same format used in the \fBzipfs::mkimg\fR command. .TP \fBzipfs::mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR . Creates a ZIP archive file named \fIoutfile\fR from the contents of the input directory \fIindir\fR (contained regular files only) with optional ZIP password \fIpassword\fR. While processing the files below \fIindir\fR the optional file name prefix given in \fIstrip\fR is stripped off the beginning of the respective file name. .RS .PP Caution: the choice of the \fIindir\fR parameter (less the optional stripped prefix) determines the later root name of the archive's content. .RE .TP \fBzipfs::mount ?\fIzipfile\fR? ?\fImountpoint\fR? ?\fIpassword\fR? . The \fBzipfs::mount\fR command mounts a ZIP archive file as a VFS. After this command executes, files contained in \fIzipfile\fR will appear to Tcl to be regular files at the mount point. .RS .PP With no \fImountpoint\fR, returns the mount point for \fIzipfile\fR. With no \fIzipfile\fR, return all zipfile/mount point pairs. If \fImountpoint\fR is specified as an empty string, the mount point will be the current directory. If \fIpassword\fR is specified, files from \fIzipfile\fR are decrypted using this password when read. .RE .TP \fBzipfs::unmount \fIzipfile\fR . Unmounts a previously mounted ZIP archive file \fIzipfile\fR. .PP The commands described above are available as subcommands in the \fBzipfs\fR ensemble, i.e. \fBzipfs list\fR is equivalent to \fBzipfs::list\fR. .SH "SEE ALSO" tclsh(1), file(n), zlib(n) .SH "KEYWORDS" compress, filesystem, zip '\" Local Variables: '\" mode: nroff '\" End: