zipfile::mkzip(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– zipfile::mkzip(n) β€” the zip-archive-maker page πŸ’–

okay bestie, welcome to zipfile::mkzip, section n of the manual, aka the Zip archive creation page πŸŽ€. Yes it's a Tcl thing. Yes it's adorable. Let's go.


✨ NAME ✨

zipfile::mkzip β€” literally just: build a zip archive πŸ—‚οΈβœ¨


🌸 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...?

πŸ¦‹ DESCRIPTION πŸ¦‹

So this package utilizes the zlib functions in Tcl 8.6 to build zip archives. that's it. that's the whole vibe. no external zip binary needed, we're doing it ourselves with core features only πŸ’…


πŸ‘‘ API πŸ‘‘

::zipfile::mkzip::mkzip zipfile ?-zipkit? ?-runtime prefix? ?-comment
string? ?-directory rootpath? ?-prepend-base-directory bool? ?-exclude
exclude? ?--? ?path...?

From http://wiki.tcl.tk/15158 🫢 (iykyk)

This command constructs a zip archive from a directory tree using nothing but Tcl 8.6 core features. The resulting zip file should be compatible with other zip programs β€” with the possible exception of unicode support. The files generated by this command use utf-8 encoding for all filenames and comments, and it has been noticed particularly on Windows that the info-zip and the Windows built-in zip view have rather poor support for this part of the ZIP file specification 😭. The 7-Zip program does correctly display utf8 filenames however, and the vfs::zip package will use these of course πŸ‘‘

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. no pressure bestie, either works πŸ’–

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. iconic. πŸ”₯

Accepted options:

  • -runtime path β€” this option specifies a file to use as prefix to the actual zip archive. If specified, -zipkit will be ignored.
  • -zipkit β€” instructs the command to generate a prefix which makes the archive a zip-based starkit 🧚. Ignored if -runtime is present.
  • -comment string β€” this option specifies a global comment to place into the generated archive πŸ’¬.
  • -directory path β€” this option specifies the directory to place into the generated archive. If specified, any argument paths are ignored.
  • -prepend-base-directory bool β€” when this option is set, the tail of the -directory path 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.

  • -exclude list β€” 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/* *~ ".#*" "*/.#*"
  • -- β€” this option signals the end of the options, forcing processing of all further words as arguments, even if they begin with a dash character 🚦.

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 -directory is specified πŸ™ˆ.

πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

This document, and the package it describes, will undoubtedly contain bugs and other problems 😭. Please report such in the category zipfile of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. Please also report any ideas for enhancements you may have for either package and/or documentation. we love feedback fr fr 🫢

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

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. (yes, the left-most one. it's giving very specific but trust the process πŸ’…)


⭐ KEYWORDS ⭐

decompression, zip


🌈 CATEGORY 🌈

File


Copyright (c) 2009 Pat Thoyts


and that's the whole page bestie πŸ¦‹βœ¨ this was zipfile::mkzip(n), brought to you by tcllib, version 1.2.4, and the footer says exactly that too so you know it's legit πŸ’– no cap, go build something cute with it. periodt πŸ’…πŸŒΈ

πŸ“¦ where this page comes from