zipfile::mkzip(3tcl)
π zipfile::mkzip β bestie edition π
okay so this is the manual page for zipfile::mkzip, from the 3tcl manual set, and it's genuinely one of my faves. we're building zip archives. from scratch. with nothing but vibes and Tcl. let's go π«Ά
β¨ NAME β¨
zipfile::mkzip β build a zip archive, bestie. that's it, that's the whole job π
πΈ SYNOPSIS πΈ
package require Tcl 8.6 9
package require zipfile::mkzip ?1.2.4?
::zipfile::mkzip::mkzip zipfile ?-zipkit? ?-runtime prefix? ?-comment
string? ?-directory rootpath? ?-prepend-base-directory bool? ?-exclude
exclude? ?--? ?path...?
like. look at her. she has options. she's the moment π
π¦ DESCRIPTION π¦
So this package lowkey flexes by using the zlib functions that live inside Tcl 8.6 to build zip archives. no external tools, no drama, just core Tcl doing the most π
π API π
::zipfile::mkzip::mkzip β the main character π
::zipfile::mkzip::mkzip zipfile ?-zipkit? ?-runtime prefix? ?-comment
string? ?-directory rootpath? ?-prepend-base-directory bool? ?-exclude
exclude? ?--? ?path...?
sourced from http://wiki.tcl.tk/15158 β yes that's literally what the page says, iykyk
okay so this command constructs a zip archive from a directory tree using nothing but Tcl 8.6 core features. nothing! not a single outside dependency. iconic behavior fr fr β¨
The resulting zip file should be compatible with other zip programs β with the possible exception of unicode support. and here's the tea β: the files generated by this command use utf-8 encoding for all filenames and comments, and it's been noticed that particularly on Windows, the info-zip and the Windows built-in zip view have rather poor support for this part of the ZIP file specification. rude of them honestly π
The 7-Zip program does correctly display utf8 filenames however, and the vfs::zip package will use these of course. as it should π
π the zipkit moment π
If you use
::mkzip::mkzip mystuff.tm -zipkit -directory mystuff.vfs
it will pack your "mystuff.vfs/" virtual filesystem tree into a zip archive with a suitable header such that on unix you may mark it executable and it should run with tclkit. Or you can run it with tclsh or wish 8.6 if you like. whatever, your choice, no pressure π«Ά
π changing the executable header π
To change the executable header, specify the -runtime "preface" where preface is a file containing code you want prefixed. For instance, on Windows you can create a self-extracting zip archive using
mkzip mystuff.exe -directory mystuff.vfs -runtime unzipsfx.exe
The "unzipsfx.exe" is the Info-Zip self-extracting stub. cute little stub. doing its lil job π₯Ί
π Accepted options π
-runtimepath β This option specifies a file to use as prefix to the actual zip archive. If specified,-zipkitwill be ignored π-zipkitβ Instructs the command to generate a prefix which makes the archive a zip-based starkit. Ignored if-runtimeis present. (they can't both be the main character, someone has to sit down π)-commentstring β This option specifies a global comment to place into the generated archive. a lil note, a lil love letter, whatever you want β¨-directorypath β This option specifies the directory to place into the generated archive. If specified, any argument paths are ignored. bye bye paths π-prepend-base-directorybool β When this option is set, the tail of the-directorypath is prepended to all paths added to the archive.
The option is ignored when option -directory is not specified.
By default this option is false.
-excludelist β This option specifies a list of glob patterns. All paths matching at least one of the patterns are not placed into the generated archive. This option defaults to
CVS/* */CVS/* *~ ".#*" "*/.#*"
(yes those are the defaults, the ~ backup files and the .# lock files get banished, periodt π
)
--β This option signals the end of the options, forcing processing of all further words as arguments, even if they begin with a dash character. the classic "okay we're DONE with flags" move π
π Accepted arguments π
- path path β Each path is a directory or file to place into the generated archive. Note however that these will be ignored when option
-directoryis specified. so don't be shocked when they ghost you π
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. (ngl, a manual page admitting it has bugs? self-aware queen π) Please report such in the category zipfile of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unified diffs, i.e the output of diff -u. fr fr, that's the format they want.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. it's giving "please use the attachment feature bestie" and honestly? valid π
β KEYWORDS β
decompression, zip
π§ CATEGORY π§
File
π COPYRIGHT π
Copyright (c) 2009 Pat Thoyts
and that's the whole page!! thanks for reading my lil essay π this was zipfile::mkzip from tcllib, version 1.2.4, and the page itself is dated 1.2.4 in the footer like a lil timestamp on a selfie. mwah, go build something slay πβ¨
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2009 Pat Thoyts
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms