zipfile::encode(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– zipfile::encode β€” the manual, but make it slay πŸ’–

okay so this is the man page for zipfile::encode, from the 3tcl section of the manual. it's the Tcllib package that lets you generate zip archives. building them, making them, birthing them into the filesystem. no cap. πŸŽ€


✨ NAME ✨

zipfile::encode β€” Generation of zip archives


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require logger

package require Trf

package require crc32

package require snit

package require zlibtcl

package require fileutil

package require zipfile::encode ?0.5.1?

::zipfile::encode ?objectName?

<encoder> comment: text

<encoder> file: dst owned src ?noCompress?

<encoder> write archive

like, look at all those requirements bestie, it's giving ecosystem πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this package hands you a class. and that class is for generation of zip archives. that's it, that's the whole vibe. you make an encoder, you feed it files, you write the archive. iconic behaviour honestly.


πŸ‘‘ CLASS API πŸ‘‘

  • ::zipfile::encode ?objectName? β€” the class command. it constructs encoder instances, aka objects, aka your little archive-building besties. the result of the command is the fully-qualified name of the instance command.

okay so about that objectName: if you don't pass one, the class will generate and use an automatic name for you. no stress. but if you do specify an objectName and it's not fully qualified, then the command gets created in the current namespace. so like, be aware of where you're standing when you call it. 🫢


πŸ’œ INSTANCE API πŸ’œ

  • <encoder> comment: text β€” sets the text of the global comment for the archive. the result of the method is the empty string. and here's the tea: if you call this method multiple times on the same encoder, the data from the last call prevails over all the previous texts. last one wins, periodt.
  • <encoder> file: dst owned src ?noCompress? β€” adds a new file to the archive. ✨
    • the contents of the file live in the filesystem at src
    • and it'll be stored in the archive under the path dst
    • if the file is declared as owned by the archive, the original file will be deleted when the archive is constructed and written. yes bestie, deleted deleted. so like, be sure that's what you want 😭
    • if noCompress is set to true, the file will not be compressed on writing
    • otherwise (and this is the default) the file is compressed if it is advantageous. smart compression. main character compression.
    • the result of the method is an empty string
  • <encoder> write archive β€” the moment we've all been waiting for πŸŽ‰ this method takes the global comment and all the added files, encodes them as a zip archive, and stores the result at path archive in the filesystem.
    • all added files which were owned by the archive get deleted at this point
    • ordering tea 🍡: the files are added to the archive in the same order as they were specified via file:
    • > note that this behaviour is new for version 0.4 and higher. before 0.4 no specific order was documented. it was lexicographically sorted. the change was made to support zip-based file formats which require a specific order of files in the archive, for example ".epub". so if you're on ancient 0.3 energy, your order was alphabetical and nobody told you. πŸ™ˆ

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

ngl, this document β€” and the package it describes β€” will undoubtedly contain bugs and other problems. it's software, babe. please report such in the category zipfile of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. also please report any ideas for enhancements you may have for either the package and/or the documentation. we want the ideas. 🧚

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. that's the whole tutorial. go forth. 🌈


⭐ KEYWORDS ⭐

compression, zip


πŸ“ CATEGORY πŸ“

File


Copyright (c) 2008-2009 Andreas Kupries


and that's the whole page bestie!! this was tcllib version 0.5.1, and yeah the header up top says zipfile::encode(3tcl) β€” now you know where it lives πŸ’– go build some archives, you absolute icon. slay βœ¨πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from