1
2[//000000001]: # (zipfile::encode \- Zip archive handling)
3[//000000002]: # (Generated from file 'encode\.man' by tcllib/doctools with format 'markdown')
4[//000000003]: # (Copyright © 2008\-2009 Andreas Kupries)
5[//000000004]: # (zipfile::encode\(n\) 0\.4 tcllib "Zip archive handling")
6
7<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
8href="../../../toc.md">Table Of Contents</a> &#124; <a
9href="../../../../index.md">Keyword Index</a> &#124; <a
10href="../../../../toc0.md">Categories</a> &#124; <a
11href="../../../../toc1.md">Modules</a> &#124; <a
12href="../../../../toc2.md">Applications</a> ] <hr>
13
14# NAME
15
16zipfile::encode \- Generation of zip archives
17
18# <a name='toc'></a>Table Of Contents
19
20  - [Table Of Contents](#toc)
21
22  - [Synopsis](#synopsis)
23
24  - [Description](#section1)
25
26  - [Class API](#section2)
27
28  - [Instance API](#section3)
29
30  - [Bugs, Ideas, Feedback](#section4)
31
32  - [Keywords](#keywords)
33
34  - [Category](#category)
35
36  - [Copyright](#copyright)
37
38# <a name='synopsis'></a>SYNOPSIS
39
40package require Tcl 8\.4
41package require logger
42package require Trf
43package require crc32
44package require snit
45package require zlibtcl
46package require fileutil
47package require zipfile::encode ?0\.4?
48
49[__::zipfile::encode__ ?*objectName*?](#1)
50[__<encoder>__ __comment:__ *text*](#2)
51[__<encoder>__ __file:__ *dst* *owned* *src* ?*noCompress*?](#3)
52[__<encoder>__ __write__ *archive*](#4)
53
54# <a name='description'></a>DESCRIPTION
55
56This package provides a class for the generation of zip archives\.
57
58# <a name='section2'></a>Class API
59
60  - <a name='1'></a>__::zipfile::encode__ ?*objectName*?
61
62    The class command constructs encoder instances, i\.e\. objects\. The result of
63    the command is the fully\-qualified name of the instance command\.
64
65    If no *objectName* is specified the class will generate and use an
66    automatic name\. If the *objectName* was specified, but is not fully
67    qualified the command will be created in the current namespace\.
68
69# <a name='section3'></a>Instance API
70
71  - <a name='2'></a>__<encoder>__ __comment:__ *text*
72
73    This method specifies the text of the global comment for the archive\. The
74    result of the method is the empty string\. In case of multiple calls to this
75    method for the same encoder the data from the last call prevails over all
76    previous texts\.
77
78  - <a name='3'></a>__<encoder>__ __file:__ *dst* *owned* *src* ?*noCompress*?
79
80    This method adds a new file to the archive\. The contents of the file are
81    found in the filesystem at *src*, and will be stored in the archive under
82    path *dst*\. If the file is declared as *owned* by the archive the
83    original file will be deleted when the archive is constructed and written\.
84    If *noCompress* is set to __true__ the file will not be compressed on
85    writing\. Otherwise \(the default\) the file is compressed if it is
86    advantageous\. The result of the method is an empty string\.
87
88  - <a name='4'></a>__<encoder>__ __write__ *archive*
89
90    This method takes the global comment and all added files, encodes them as a
91    zip archive and stores the result at path *archive* in the filesystem\. All
92    added files which were owned by the archive are deleted at this point\. On
93    the issue of ordering, the files are added to the archive in the same order
94    as they were specified via __file:__\. *Note* that this behaviour is
95    new for version 0\.4 and higher\. Before 0\.4 no specific order was documented\.
96    It was lexicographically sorted\. The change was made to support
97    __[zip](\.\./\.\./\.\./\.\./index\.md\#zip)__\-based file formats which require
98    a specific order of files in the archive, for example "\.epub"\.
99
100# <a name='section4'></a>Bugs, Ideas, Feedback
101
102This document, and the package it describes, will undoubtedly contain bugs and
103other problems\. Please report such in the category *zipfile* of the [Tcllib
104Trackers](http://core\.tcl\.tk/tcllib/reportlist)\. Please also report any ideas
105for enhancements you may have for either package and/or documentation\.
106
107When proposing code changes, please provide *unified diffs*, i\.e the output of
108__diff \-u__\.
109
110Note further that *attachments* are strongly preferred over inlined patches\.
111Attachments can be made by going to the __Edit__ form of the ticket
112immediately after its creation, and then using the left\-most button in the
113secondary navigation bar\.
114
115# <a name='keywords'></a>KEYWORDS
116
117[compression](\.\./\.\./\.\./\.\./index\.md\#compression),
118[zip](\.\./\.\./\.\./\.\./index\.md\#zip)
119
120# <a name='category'></a>CATEGORY
121
122File
123
124# <a name='copyright'></a>COPYRIGHT
125
126Copyright &copy; 2008\-2009 Andreas Kupries
127