1zipfile::encode(n) Zip archive handling zipfile::encode(n)
2
3
4
5______________________________________________________________________________
6
8 zipfile::encode - Generation of zip archives
9
11 package require Tcl 8.4
12
13 package require logger
14
15 package require Trf
16
17 package require crc32
18
19 package require snit
20
21 package require zlibtcl
22
23 package require fileutil
24
25 package require zipfile::encode ?0.4?
26
27 ::zipfile::encode ?objectName?
28
29 <encoder> comment: text
30
31 <encoder> file: dst owned src ?noCompress?
32
33 <encoder> write archive
34
35______________________________________________________________________________
36
38 This package provides a class for the generation of zip archives.
39
41 ::zipfile::encode ?objectName?
42 The class command constructs encoder instances, i.e. objects.
43 The result of the command is the fully-qualified name of the
44 instance command.
45
46 If no objectName is specified the class will generate and use an
47 automatic name. If the objectName was specified, but is not
48 fully qualified the command will be created in the current
49 namespace.
50
52 <encoder> comment: text
53 This method specifies the text of the global comment for the ar‐
54 chive. The result of the method is the empty string. In case
55 of multiple calls to this method for the same encoder the data
56 from the last call prevails over all previous texts.
57
58 <encoder> file: dst owned src ?noCompress?
59 This method adds a new file to the archive. The contents of the
60 file are found in the filesystem at src, and will be stored in
61 the archive under path dst. If the file is declared as owned by
62 the archive the original file will be deleted when the archive
63 is constructed and written. If noCompress is set to true the
64 file will not be compressed on writing. Otherwise (the default)
65 the file is compressed if it is advantageous. The result of the
66 method is an empty string.
67
68 <encoder> write archive
69 This method takes the global comment and all added files,
70 encodes them as a zip archive and stores the result at path ar‐
71 chive in the filesystem. All added files which were owned by
72 the archive are deleted at this point. On the issue of order‐
73 ing, the files are added to the archive in the same order as
74 they were specified via file:. Note that this behaviour is new
75 for version 0.4 and higher. Before 0.4 no specific order was
76 documented. It was lexicographically sorted. The change was made
77 to support zip-based file formats which require a specific order
78 of files in the archive, for example ".epub".
79
81 This document, and the package it describes, will undoubtedly contain
82 bugs and other problems. Please report such in the category zipfile of
83 the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
84 also report any ideas for enhancements you may have for either package
85 and/or documentation.
86
87 When proposing code changes, please provide unified diffs, i.e the out‐
88 put of diff -u.
89
90 Note further that attachments are strongly preferred over inlined
91 patches. Attachments can be made by going to the Edit form of the
92 ticket immediately after its creation, and then using the left-most
93 button in the secondary navigation bar.
94
96 compression, zip
97
99 File
100
102 Copyright (c) 2008-2009 Andreas Kupries
103
104
105
106
107tcllib 0.4 zipfile::encode(n)