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
87 Create/Open Archive
88 • [22mzip_open(3)
89
90 Add/Change Files and Directories
91 • [22mzip_dir_add(3)
92 • [22mzip_file_add(3)
93 • [22mzip_file_replace(3)
94 • [22mzip_file_set_comment(3)
95 • [22mzip_file_set_dostime(3)
96 • [22mzip_file_set_external_attributes(3)
97 • [22mzip_file_set_encryption(3)
98 • [22mzip_file_set_mtime(3)
99 • [22mzip_set_file_compression(3)
100 • [22mzip_source_buffer(3)
101 • [22mzip_source_file(3)
102 • [22mzip_source_filep(3)
103 • [22mzip_source_free(3)
104 • [22mzip_source_function(3)
105 • [22mzip_source_zip(3)
106
107 Rename Files
108 • [22mzip_rename(3)
109
110 Delete Files
111 • [22mzip_delete(3)
112
113 Revert Changes
114 • [22mzip_unchange(3)
115 • [22mzip_unchange_all(3)
116 • [22mzip_unchange_archive(3)
117
118 Read/Modify Extra Fields
119 • [22mzip_file_extra_field_by_id(3)
120 • [22mzip_file_extra_field_delete(3)
121 • [22mzip_file_extra_field_delete_by_id(3)
122 • [22mzip_file_extra_field_get(3)
123 • [22mzip_file_extra_field_set(3)
124 • [22mzip_file_extra_fields_count(3)
125 • [22mzip_file_extra_fields_count_by_id(3)
126
127 Close Archive (Writing)
128 • [22mzip_close(3)
129 • [22mzip_discard(3)
130
131 Miscellaneous (Writing)
132 • [22mzip_file_attributes_init(3)
133 • [22mzip_libzip_version(3)
134 • [22mzip_register_cancel_callback_with_state(3)
135 • [22mzip_register_progress_callback_with_state(3)
136 • [22mzip_set_archive_comment(3)
137 • [22mzip_set_archive_flag(3)
138 • [22mzip_source(3)
139
141 • [22mzip_error_strerror(3)
142 • [22mzip_strerror(3)
143 • [22mzip_file_strerror(3)
144 • [22mzip_file_get_error(3)
145 • [22mzip_get_error(3)
146 • [22mzip_error_init_with_code(3)
147 • [22mzip_error_system_type(3)
148 • [22mzip_errors(3)
149
151 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
152
153BSD June 18, 2022 BSD