Imported Upstream version 1.9.0
[platform/upstream/libzip.git] / man / libzip.html
1 <!DOCTYPE html>
2 <html>
3 <!-- This is an automatically generated file.  Do not edit.
4    libzip.mdoc -- general overview of available functions
5    Copyright (C) 2005-2022 Dieter Baron and Thomas Klausner
6   
7    This file is part of libzip, a library to manipulate ZIP archives.
8    The authors can be contacted at <libzip@nih.at>
9   
10    Redistribution and use in source and binary forms, with or without
11    modification, are permitted provided that the following conditions
12    are met:
13    1. Redistributions of source code must retain the above copyright
14       notice, this list of conditions and the following disclaimer.
15    2. Redistributions in binary form must reproduce the above copyright
16       notice, this list of conditions and the following disclaimer in
17       the documentation and/or other materials provided with the
18       distribution.
19    3. The names of the authors may not be used to endorse or promote
20       products derived from this software without specific prior
21       written permission.
22   
23    THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
24    OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26    ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
27    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
31    IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34    -->
35 <head>
36   <meta charset="utf-8"/>
37   <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/>
38   <title>LIBZIP(3)</title>
39 </head>
40 <body>
41 <table class="head">
42   <tr>
43     <td class="head-ltitle">LIBZIP(3)</td>
44     <td class="head-vol">Library Functions Manual</td>
45     <td class="head-rtitle">LIBZIP(3)</td>
46   </tr>
47 </table>
48 <div class="manual-text">
49 <section class="Sh">
50 <h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
51 <code class="Nm">libzip</code> &#x2014;
52 <div class="Nd">library for manipulating zip archives</div>
53 </section>
54 <section class="Sh">
55 <h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1>
56 libzip (-lzip)
57 </section>
58 <section class="Sh">
59 <h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
60 <code class="In">#include &lt;<a class="In">zip.h</a>&gt;</code>
61 </section>
62 <section class="Sh">
63 <h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
64 <code class="Nm">libzip</code> is a library for reading, creating, and modifying
65   zip archives.
66 <p class="Pp">The main design criteria for <code class="Nm">libzip</code>
67   were:</p>
68 <ul class="Bl-bullet Bl-compact">
69   <li>Do not create corrupt files, even in case of errors.</li>
70   <li>Do not delete data.</li>
71   <li>Be efficient.</li>
72 </ul>
73 <p class="Pp">For this reason, when modifying zip archives,
74     <code class="Nm">libzip</code> writes to a temporary file and replaces the
75     original zip archive atomically.</p>
76 <p class="Pp">Below there are two sections listing functions: one for how to
77     read from zip archives and one for how to create/modify them.</p>
78 </section>
79 <section class="Sh">
80 <h1 class="Sh" id="FILE_NAMES"><a class="permalink" href="#FILE_NAMES">FILE
81   NAMES</a></h1>
82 <section class="Ss">
83 <h2 class="Ss" id="Encoding"><a class="permalink" href="#Encoding">Encoding</a></h2>
84 Names of files in the host file system are expected in UTF-8 encoding. On
85   Windows, variants for ASCII and UTF-16 are also available.
86 <p class="Pp">Names of files inside archives are by default expected in UTF-8
87     encoding. Other encodings can be requested by using the flags
88     <code class="Dv">ZIP_FL_ENC_CP437</code> and
89     <code class="Dv">ZIP_FL_ENC_RAW</code>.</p>
90 <p class="Pp">For details see the relevant man pages.</p>
91 </section>
92 <section class="Ss">
93 <h2 class="Ss" id="Directory_Separator"><a class="permalink" href="#Directory_Separator">Directory
94   Separator</a></h2>
95 The zip format requires the use of forward slash (&#x2018;/&#x2019;) as
96   directory separator. Since backslash (&#x2018;\&#x2019;) can be part of a
97   valid file name on Unix systems, <code class="Nm">libzip</code> does not
98   automatically convert them, even on Windows. It is the responsibility of the
99   programmer to ensure that all directory separators are passed as forward
100   slashes to <code class="Nm">libzip</code>.
101 </section>
102 </section>
103 <section class="Sh">
104 <h1 class="Sh" id="THREAD_SAFETY"><a class="permalink" href="#THREAD_SAFETY">THREAD
105   SAFETY</a></h1>
106 In general, different zip archives opened by <code class="Nm">libzip</code> are
107   independent of each other and can be used by parallel-running threads without
108   locking. If you want to use an archive from multiple threads, you have to
109   synchronize access to it yourself. If you use an archive as a source for
110   <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a> or
111   <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>, access to
112   the target archive must be synchronized with access to the source archive as
113   well.
114 </section>
115 <section class="Sh">
116 <h1 class="Sh" id="READING_ZIP_ARCHIVES"><a class="permalink" href="#READING_ZIP_ARCHIVES">READING
117   ZIP ARCHIVES</a></h1>
118 <section class="Ss">
119 <h2 class="Ss" id="Open_Archive"><a class="permalink" href="#Open_Archive">Open
120   Archive</a></h2>
121 <ul class="Bl-bullet Bl-compact">
122   <li><a class="Xr" href="zip_open.html">zip_open(3)</a></li>
123   <li><a class="Xr" href="zip_fdopen.html">zip_fdopen(3)</a></li>
124 </ul>
125 </section>
126 <section class="Ss">
127 <h2 class="Ss" id="Find_Files"><a class="permalink" href="#Find_Files">Find
128   Files</a></h2>
129 <ul class="Bl-bullet Bl-compact">
130   <li><a class="Xr" href="zip_name_locate.html">zip_name_locate(3)</a></li>
131 </ul>
132 </section>
133 <section class="Ss">
134 <h2 class="Ss" id="Read_Files"><a class="permalink" href="#Read_Files">Read
135   Files</a></h2>
136 <ul class="Bl-bullet Bl-compact">
137   <li><a class="Xr" href="zip_fopen.html">zip_fopen(3)</a></li>
138   <li><a class="Xr" href="zip_fopen_encrypted.html">zip_fopen_encrypted(3)</a></li>
139   <li><a class="Xr" href="zip_fopen_index.html">zip_fopen_index(3)</a></li>
140   <li><a class="Xr" href="zip_fopen_index_encrypted.html">zip_fopen_index_encrypted(3)</a></li>
141   <li><a class="Xr" href="zip_fread.html">zip_fread(3)</a></li>
142   <li><a class="Xr" href="zip_file_is_seekable.html">zip_file_is_seekable(3)</a></li>
143   <li><a class="Xr" href="zip_fseek.html">zip_fseek(3)</a> (uncompressed files
144       only)</li>
145   <li><a class="Xr" href="zip_ftell.html">zip_ftell(3)</a></li>
146   <li><a class="Xr" href="zip_fclose.html">zip_fclose(3)</a></li>
147 </ul>
148 </section>
149 <section class="Ss">
150 <h2 class="Ss" id="Close_Archive"><a class="permalink" href="#Close_Archive">Close
151   Archive</a></h2>
152 <ul class="Bl-bullet Bl-compact">
153   <li><a class="Xr" href="zip_close.html">zip_close(3)</a></li>
154 </ul>
155 </section>
156 <section class="Ss">
157 <h2 class="Ss" id="Miscellaneous"><a class="permalink" href="#Miscellaneous">Miscellaneous</a></h2>
158 <ul class="Bl-bullet Bl-compact">
159   <li><a class="Xr" href="zip_stat.html">zip_stat(3)</a></li>
160   <li><a class="Xr" href="zip_compression_method_supported.html">zip_compression_method_supported(3)</a></li>
161   <li><a class="Xr" href="zip_encryption_method_supported.html">zip_encryption_method_supported(3)</a></li>
162   <li><a class="Xr" href="zip_file_get_comment.html">zip_file_get_comment(3)</a></li>
163   <li><a class="Xr" href="zip_file_get_external_attributes.html">zip_file_get_external_attributes(3)</a></li>
164   <li><a class="Xr" href="zip_get_archive_comment.html">zip_get_archive_comment(3)</a></li>
165   <li><a class="Xr" href="zip_get_archive_flag.html">zip_get_archive_flag(3)</a></li>
166   <li><a class="Xr" href="zip_get_name.html">zip_get_name(3)</a></li>
167   <li><a class="Xr" href="zip_get_num_entries.html">zip_get_num_entries(3)</a></li>
168   <li><a class="Xr" href="zip_set_default_password.html">zip_set_default_password(3)</a></li>
169 </ul>
170 </section>
171 </section>
172 <section class="Sh">
173 <h1 class="Sh" id="CREATING/MODIFYING_ZIP_ARCHIVES"><a class="permalink" href="#CREATING/MODIFYING_ZIP_ARCHIVES">CREATING/MODIFYING
174   ZIP ARCHIVES</a></h1>
175 <section class="Ss">
176 <h2 class="Ss" id="Create/Open_Archive"><a class="permalink" href="#Create/Open_Archive">Create/Open
177   Archive</a></h2>
178 <ul class="Bl-bullet Bl-compact">
179   <li><a class="Xr" href="zip_open.html">zip_open(3)</a></li>
180 </ul>
181 </section>
182 <section class="Ss">
183 <h2 class="Ss" id="Add/Change_Files_and_Directories"><a class="permalink" href="#Add/Change_Files_and_Directories">Add/Change
184   Files and Directories</a></h2>
185 <ul class="Bl-bullet Bl-compact">
186   <li><a class="Xr" href="zip_dir_add.html">zip_dir_add(3)</a></li>
187   <li><a class="Xr" href="zip_file_add.html">zip_file_add(3)</a></li>
188   <li><a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a></li>
189   <li><a class="Xr" href="zip_file_set_comment.html">zip_file_set_comment(3)</a></li>
190   <li><a class="Xr" href="zip_file_set_dostime.html">zip_file_set_dostime(3)</a></li>
191   <li><a class="Xr" href="zip_file_set_external_attributes.html">zip_file_set_external_attributes(3)</a></li>
192   <li><a class="Xr" href="zip_file_set_encryption.html">zip_file_set_encryption(3)</a></li>
193   <li><a class="Xr" href="zip_file_set_mtime.html">zip_file_set_mtime(3)</a></li>
194   <li><a class="Xr" href="zip_set_file_compression.html">zip_set_file_compression(3)</a></li>
195   <li><a class="Xr" href="zip_source_buffer.html">zip_source_buffer(3)</a></li>
196   <li><a class="Xr" href="zip_source_file.html">zip_source_file(3)</a></li>
197   <li><a class="Xr" href="zip_source_filep.html">zip_source_filep(3)</a></li>
198   <li><a class="Xr" href="zip_source_free.html">zip_source_free(3)</a></li>
199   <li><a class="Xr" href="zip_source_function.html">zip_source_function(3)</a></li>
200   <li><a class="Xr" href="zip_source_zip.html">zip_source_zip(3)</a></li>
201 </ul>
202 </section>
203 <section class="Ss">
204 <h2 class="Ss" id="Rename_Files"><a class="permalink" href="#Rename_Files">Rename
205   Files</a></h2>
206 <ul class="Bl-bullet Bl-compact">
207   <li><a class="Xr" href="zip_rename.html">zip_rename(3)</a></li>
208 </ul>
209 </section>
210 <section class="Ss">
211 <h2 class="Ss" id="Delete_Files"><a class="permalink" href="#Delete_Files">Delete
212   Files</a></h2>
213 <ul class="Bl-bullet Bl-compact">
214   <li><a class="Xr" href="zip_delete.html">zip_delete(3)</a></li>
215 </ul>
216 </section>
217 <section class="Ss">
218 <h2 class="Ss" id="Revert_Changes"><a class="permalink" href="#Revert_Changes">Revert
219   Changes</a></h2>
220 <ul class="Bl-bullet Bl-compact">
221   <li><a class="Xr" href="zip_unchange.html">zip_unchange(3)</a></li>
222   <li><a class="Xr" href="zip_unchange_all.html">zip_unchange_all(3)</a></li>
223   <li><a class="Xr" href="zip_unchange_archive.html">zip_unchange_archive(3)</a></li>
224 </ul>
225 </section>
226 <section class="Ss">
227 <h2 class="Ss" id="Read/Modify_Extra_Fields"><a class="permalink" href="#Read/Modify_Extra_Fields">Read/Modify
228   Extra Fields</a></h2>
229 <ul class="Bl-bullet Bl-compact">
230   <li><a class="Xr" href="zip_file_extra_field_by_id.html">zip_file_extra_field_by_id(3)</a></li>
231   <li><a class="Xr" href="zip_file_extra_field_delete.html">zip_file_extra_field_delete(3)</a></li>
232   <li><a class="Xr" href="zip_file_extra_field_delete_by_id.html">zip_file_extra_field_delete_by_id(3)</a></li>
233   <li><a class="Xr" href="zip_file_extra_field_get.html">zip_file_extra_field_get(3)</a></li>
234   <li><a class="Xr" href="zip_file_extra_field_set.html">zip_file_extra_field_set(3)</a></li>
235   <li><a class="Xr" href="zip_file_extra_fields_count.html">zip_file_extra_fields_count(3)</a></li>
236   <li><a class="Xr" href="zip_file_extra_fields_count_by_id.html">zip_file_extra_fields_count_by_id(3)</a></li>
237 </ul>
238 </section>
239 <section class="Ss">
240 <h2 class="Ss" id="Close_Archive_(Writing)"><a class="permalink" href="#Close_Archive_(Writing)">Close
241   Archive (Writing)</a></h2>
242 <ul class="Bl-bullet Bl-compact">
243   <li><a class="Xr" href="zip_close.html">zip_close(3)</a></li>
244   <li><a class="Xr" href="zip_discard.html">zip_discard(3)</a></li>
245 </ul>
246 </section>
247 <section class="Ss">
248 <h2 class="Ss" id="Miscellaneous_(Writing)"><a class="permalink" href="#Miscellaneous_(Writing)">Miscellaneous
249   (Writing)</a></h2>
250 <ul class="Bl-bullet Bl-compact">
251   <li><a class="Xr" href="zip_file_attributes_init.html">zip_file_attributes_init(3)</a></li>
252   <li><a class="Xr" href="zip_libzip_version.html">zip_libzip_version(3)</a></li>
253   <li><a class="Xr" href="zip_register_cancel_callback_with_state.html">zip_register_cancel_callback_with_state(3)</a></li>
254   <li><a class="Xr" href="zip_register_progress_callback_with_state.html">zip_register_progress_callback_with_state(3)</a></li>
255   <li><a class="Xr" href="zip_set_archive_comment.html">zip_set_archive_comment(3)</a></li>
256   <li><a class="Xr" href="zip_set_archive_flag.html">zip_set_archive_flag(3)</a></li>
257   <li><a class="Xr" href="zip_source.html">zip_source(3)</a></li>
258 </ul>
259 </section>
260 </section>
261 <section class="Sh">
262 <h1 class="Sh" id="ERROR_HANDLING"><a class="permalink" href="#ERROR_HANDLING">ERROR
263   HANDLING</a></h1>
264 <ul class="Bl-bullet Bl-compact">
265   <li><a class="Xr" href="zip_error_strerror.html">zip_error_strerror(3)</a></li>
266   <li><a class="Xr" href="zip_strerror.html">zip_strerror(3)</a></li>
267   <li><a class="Xr" href="zip_file_strerror.html">zip_file_strerror(3)</a></li>
268   <li><a class="Xr" href="zip_file_get_error.html">zip_file_get_error(3)</a></li>
269   <li><a class="Xr" href="zip_get_error.html">zip_get_error(3)</a></li>
270   <li><a class="Xr" href="zip_error_init_with_code.html">zip_error_init_with_code(3)</a></li>
271   <li><a class="Xr" href="zip_error_system_type.html">zip_error_system_type(3)</a></li>
272   <li><a class="Xr" href="zip_errors.html">zip_errors(3)</a></li>
273 </ul>
274 </section>
275 <section class="Sh">
276 <h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
277 <span class="An">Dieter Baron</span>
278   &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
279   <span class="An">Thomas Klausner</span>
280   &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
281 </section>
282 </div>
283 <table class="foot">
284   <tr>
285     <td class="foot-date">June 18, 2022</td>
286     <td class="foot-os">NiH</td>
287   </tr>
288 </table>
289 </body>
290 </html>