1LIBZIP(3) BSD Library Functions Manual LIBZIP(3)
2
4 libzip — library for manipulating zip archives
5
7 libzip (-lzip)
8
10 #include <zip.h>
11
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
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
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
53 Open Archive
54 • [22mzip_open(3)
55 • [22mzip_fdopen(3)
56
57 Find Files
58 • [22mzip_name_locate(3)
59
60 Read Files
61 • [22mzip_fopen(3)
62 • [22mzip_fopen_encrypted(3)
63 • [22mzip_fopen_index(3)
64 • [22mzip_fopen_index_encrypted(3)
65 • [22mzip_fread(3)
66 • [22mzip_file_is_seekable(3)
67 • [22mzip_fseek(3) (uncompressed files only)
68 • [22mzip_ftell(3)
69 • [22mzip_fclose(3)
70
71 Close Archive
72 • [22mzip_close(3)
73
74 Miscellaneous
75 • [22mzip_stat(3)
76 • [22mzip_compression_method_supported(3)
77 • [22mzip_encryption_method_supported(3)
78 • [22mzip_file_get_comment(3)
79 • [22mzip_file_get_external_attributes(3)
80 • [22mzip_get_archive_comment(3)
81 • [22mzip_get_archive_flag(3)
82 • [22mzip_get_name(3)
83 • [22mzip_get_num_entries(3)
84 • [22mzip_set_default_password(3)
85 • [22mzip_source_pass_to_lower_layer(3)
86
88 Create/Open Archive
89 • [22mzip_open(3)
90
91 Add/Change Files and Directories
92 • [22mzip_dir_add(3)
93 • [22mzip_file_add(3)
94 • [22mzip_file_replace(3)
95 • [22mzip_file_set_comment(3)
96 • [22mzip_file_set_dostime(3)
97 • [22mzip_file_set_external_attributes(3)
98 • [22mzip_file_set_encryption(3)
99 • [22mzip_file_set_mtime(3)
100 • [22mzip_set_file_compression(3)
101 • [22mzip_source_buffer(3)
102 • [22mzip_source_file(3)
103 • [22mzip_source_filep(3)
104 • [22mzip_source_free(3)
105 • [22mzip_source_function(3)
106 • [22mzip_source_layered(3)
107 • [22mzip_source_zip(3)
108
109 Rename Files
110 • [22mzip_rename(3)
111
112 Delete Files
113 • [22mzip_delete(3)
114
115 Revert Changes
116 • [22mzip_unchange(3)
117 • [22mzip_unchange_all(3)
118 • [22mzip_unchange_archive(3)
119
120 Read/Modify Extra Fields
121 • [22mzip_file_extra_field_delete(3)
122 • [22mzip_file_extra_field_delete_by_id(3)
123 • [22mzip_file_extra_field_get(3)
124 • [22mzip_file_extra_field_get_by_id(3)
125 • [22mzip_file_extra_field_set(3)
126 • [22mzip_file_extra_fields_count(3)
127 • [22mzip_file_extra_fields_count_by_id(3)
128
129 Close Archive (Writing)
130 • [22mzip_close(3)
131 • [22mzip_discard(3)
132
133 Miscellaneous (Writing)
134 • [22mzip_file_attributes_init(3)
135 • [22mzip_libzip_version(3)
136 • [22mzip_register_cancel_callback_with_state(3)
137 • [22mzip_register_progress_callback_with_state(3)
138 • [22mzip_set_archive_comment(3)
139 • [22mzip_set_archive_flag(3)
140 • [22mzip_source(3)
141
143 • [22mzip_error_strerror(3)
144 • [22mzip_strerror(3)
145 • [22mzip_file_strerror(3)
146 • [22mzip_file_get_error(3)
147 • [22mzip_get_error(3)
148 • [22mzip_error_init_with_code(3)
149 • [22mzip_error_set(3)
150 • [22mzip_error_set_from_source(3)
151 • [22mzip_error_system_type(3)
152 • [22mzip_errors(3)
153
155 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
156
157BSD December 5, 2022 BSD