1LIBZIP(3)                BSD Library Functions Manual                LIBZIP(3)
2

NAME

4     libzip — library for manipulating zip archives
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11

DESCRIPTION

13     libzip is a library for reading, creating, and modifying zip archives.
14
15     The main design criteria for libzip were:
16     Do not create corrupt files, even in case of errors.
17     Do not delete data.
18     Be efficient.
19
20     For this reason, when modifying zip archives, libzip writes to a tempo‐
21     rary file and replaces the original zip archive atomically.
22
23     Below there are two sections listing functions: one for how to read from
24     zip archives and one for how to create/modify them.
25

FILE NAMES

27   Encoding
28     Names of files in the host file system are expected in UTF-8 encoding.
29     On Windows, variants for ASCII and UTF-16 are also available.
30
31     Names of files inside archives are by default expected in UTF-8 encoding.
32     Other encodings can be requested by using the flags ZIP_FL_ENC_CP437 and
33     ZIP_FL_ENC_RAW.
34
35     For details see the relevant man pages.
36
37   Directory Separator
38     The zip format requires the use of forward slash (‘/’) as directory sepa‐
39     rator.  Since backslash (‘\’) can be part of a valid file name on Unix
40     systems, libzip does not automatically convert them, even on Windows.  It
41     is the responsibility of the programmer to ensure that all directory sep‐
42     arators are passed as forward slashes to libzip.
43

THREAD SAFETY

45     In general, different zip archives opened by libzip are independent of
46     each other and can be used by parallel-running threads without locking.
47     If you want to use an archive from multiple threads, you have to synchro‐
48     nize access to it yourself.  If you use an archive as a source for
49     zip_file_add(3) or zip_file_replace(3), access to the target archive must
50     be synchronized with access to the source archive as well.
51

READING ZIP ARCHIVES

53   Open Archive
54     •   zip_open(3)
55     •   zip_fdopen(3)
56
57   Find Files
58     •   zip_name_locate(3)
59
60   Read Files
61     •   zip_fopen(3)
62     •   zip_fopen_encrypted(3)
63     •   zip_fopen_index(3)
64     •   zip_fopen_index_encrypted(3)
65     •   zip_fread(3)
66     •   zip_file_is_seekable(3)
67     •   zip_fseek(3) (uncompressed files only)
68     •   zip_ftell(3)
69     •   zip_fclose(3)
70
71   Close Archive
72     •   zip_close(3)
73
74   Miscellaneous
75     •   zip_stat(3)
76     •   zip_compression_method_supported(3)
77     •   zip_encryption_method_supported(3)
78     •   zip_file_get_comment(3)
79     •   zip_file_get_external_attributes(3)
80     •   zip_get_archive_comment(3)
81     •   zip_get_archive_flag(3)
82     •   zip_get_name(3)
83     •   zip_get_num_entries(3)
84     •   zip_set_default_password(3)
85

CREATING/MODIFYING ZIP ARCHIVES

87   Create/Open Archive
88     •   zip_open(3)
89
90   Add/Change Files and Directories
91     •   zip_dir_add(3)
92     •   zip_file_add(3)
93     •   zip_file_replace(3)
94     •   zip_file_set_comment(3)
95     •   zip_file_set_dostime(3)
96     •   zip_file_set_external_attributes(3)
97     •   zip_file_set_encryption(3)
98     •   zip_file_set_mtime(3)
99     •   zip_set_file_compression(3)
100     •   zip_source_buffer(3)
101     •   zip_source_file(3)
102     •   zip_source_filep(3)
103     •   zip_source_free(3)
104     •   zip_source_function(3)
105     •   zip_source_zip(3)
106
107   Rename Files
108     •   zip_rename(3)
109
110   Delete Files
111     •   zip_delete(3)
112
113   Revert Changes
114     •   zip_unchange(3)
115     •   zip_unchange_all(3)
116     •   zip_unchange_archive(3)
117
118   Read/Modify Extra Fields
119     •   zip_file_extra_field_by_id(3)
120     •   zip_file_extra_field_delete(3)
121     •   zip_file_extra_field_delete_by_id(3)
122     •   zip_file_extra_field_get(3)
123     •   zip_file_extra_field_set(3)
124     •   zip_file_extra_fields_count(3)
125     •   zip_file_extra_fields_count_by_id(3)
126
127   Close Archive (Writing)
128     •   zip_close(3)
129     •   zip_discard(3)
130
131   Miscellaneous (Writing)
132     •   zip_file_attributes_init(3)
133     •   zip_libzip_version(3)
134     •   zip_register_cancel_callback_with_state(3)
135     •   zip_register_progress_callback_with_state(3)
136     •   zip_set_archive_comment(3)
137     •   zip_set_archive_flag(3)
138     •   zip_source(3)
139

ERROR HANDLING

141     •   zip_error_strerror(3)
142     •   zip_strerror(3)
143     •   zip_file_strerror(3)
144     •   zip_file_get_error(3)
145     •   zip_get_error(3)
146     •   zip_error_init_with_code(3)
147     •   zip_error_system_type(3)
148     •   zip_errors(3)
149

AUTHORS

151     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
152
153BSD                              June 18, 2022                             BSD
Impressum