1zipfile::decode(n)           Zip archive handling           zipfile::decode(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       zipfile::decode - Access to zip archives
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require fileutil::decode  0.2.1
14
15       package require Trf
16
17       package require zlibtcl
18
19       package require zipfile::decode  ?0.9?
20
21       ::zipfile::decode::archive
22
23       ::zipfile::decode::close
24
25       ::zipfile::decode::comment adict
26
27       ::zipfile::decode::content archive
28
29       ::zipfile::decode::copyfile adict path dst
30
31       ::zipfile::decode::files adict
32
33       ::zipfile::decode::getfile zdict path
34
35       ::zipfile::decode::hasfile adict path
36
37       ::zipfile::decode::filesize zdict path
38
39       ::zipfile::decode::filecomment zdict path
40
41       ::zipfile::decode::iszip archive
42
43       ::zipfile::decode::open archive
44
45       ::zipfile::decode::unzip adict dstdir
46
47       ::zipfile::decode::unzipfile archive dstdir
48
49______________________________________________________________________________
50

DESCRIPTION

52       Note:  packages  Trf  and zlibtcl are not required if TCL 8.6 is avail‐
53       able.  This package provides commands to decompress and access the con‐
54       tents of zip archives.
55

API

57       ::zipfile::decode::archive
58              This  command  decodes  the last opened (and not yet closed) zip
59              archive file.  The result of the command  is  a  dictionary  de‐
60              scribing the contents of the archive. The structure of this dic‐
61              tionary is not public. Proper access should be made through  the
62              provided accessor commands of this package.
63
64       ::zipfile::decode::close
65              This command releases all state associated with the last call of
66              ::zipfile::decode::open.  The result of the command is the empty
67              string.
68
69       ::zipfile::decode::comment adict
70              This  command  takes  a dictionary describing the currently open
71              zip archive file, as returned by ::zipfile::decode::archive, and
72              returns the global comment of the archive.
73
74       ::zipfile::decode::content archive
75              This  is  a  convenience command which decodes the specified zip
76              archive file and returns the list of paths found in  it  as  its
77              result.
78
79       ::zipfile::decode::copyfile adict path dst
80              This  command  takes  a dictionary describing the currently open
81              zip archive file, as returned by ::zipfile::decode::archive, and
82              copies the decompressed contents of the file path in the archive
83              to the the file dst.  An error is thrown  if  the  file  is  not
84              found in the archive.
85
86       ::zipfile::decode::files adict
87              This  command  takes  a dictionary describing the currently open
88              zip archive file, as returned by ::zipfile::decode::archive, and
89              returns the list of files found in the archive.
90
91       ::zipfile::decode::getfile zdict path
92              This  command  takes  a dictionary describing the currently open
93              zip archive file, as returned by ::zipfile::decode::archive, and
94              returns  the  decompressed  contents of the file path in the ar‐
95              chive.  An error is thrown if the file is not found in  the  ar‐
96              chive.
97
98       ::zipfile::decode::hasfile adict path
99              This  command  takes  a dictionary describing the currently open
100              zip archive file, as returned by ::zipfile::decode::archive, and
101              check if the specified path is found in the archive.  The result
102              of the command is a boolean flag, true if the path is found, and
103              false otherwise.
104
105       ::zipfile::decode::filesize zdict path
106              This  command  takes  a dictionary describing the currently open
107              zip archive file, as returned by ::zipfile::decode::archive, and
108              returns  the  decompressed size of the file path in the archive.
109              An error is thrown if the file is not found in the archive.
110
111       ::zipfile::decode::filecomment zdict path
112              This command takes a dictionary describing  the  currently  open
113              zip archive file, as returned by ::zipfile::decode::archive, and
114              returns the per-file comment of the file path  in  the  archive.
115              An error is thrown if the file is not found in the archive.
116
117       ::zipfile::decode::iszip archive
118              This  command  takes the path of a presumed zip archive file and
119              returns a boolean flag as the result of the command  telling  us
120              if it actually is a zip archive (true), or not (false).
121
122       ::zipfile::decode::open archive
123              This  command  takes the path of a zip archive file and prepares
124              it for decoding.  The result of the command is the empty string.
125              All  important information is stored in global state.  If multi‐
126              ple open calls are made one after the other only  the  state  of
127              the last call is available to the other commands.
128
129       ::zipfile::decode::unzip adict dstdir
130              This  command  takes  a dictionary describing the currently open
131              zip archive file, as returned by ::zipfile::decode::archive, and
132              unpacks  the  archive in the given destination directory dstdir.
133              The result of the command is the empty string.
134
135       ::zipfile::decode::unzipfile archive dstdir
136              This is a convenience command which unpacks  the  specified  zip
137              archive file in the given destination directory dstdir.
138
139              The result of the command is the empty string.
140

BUGS, IDEAS, FEEDBACK

142       This  document,  and the package it describes, will undoubtedly contain
143       bugs and other problems.  Please report such in the category zipfile of
144       the  Tcllib  Trackers  [http://core.tcl.tk/tcllib/reportlist].   Please
145       also report any ideas for enhancements you may have for either  package
146       and/or documentation.
147
148       When proposing code changes, please provide unified diffs, i.e the out‐
149       put of diff -u.
150
151       Note further that  attachments  are  strongly  preferred  over  inlined
152       patches.  Attachments  can  be  made  by  going to the Edit form of the
153       ticket immediately after its creation, and  then  using  the  left-most
154       button in the secondary navigation bar.
155

KEYWORDS

157       decompression, zip
158

CATEGORY

160       File
161
163       Copyright (c) 2008-2022 Andreas Kupries
164
165
166
167
168tcllib                                0.9                   zipfile::decode(n)
Impressum