1ZIP_SET_FILE_COMPRESS... BSD Library Functions Manual ZIP_SET_FILE_COMPRESS...
2

NAME

4     zip_set_file_compression — set compression method for file in zip
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11
12     int
13     zip_set_file_compression(zip_t *archive, zip_uint64_t index,
14         zip_int32_t comp, zip_uint32_t comp_flags);
15

DESCRIPTION

17     The zip_set_file_compression() function sets the compression method for
18     the file at position index in the zip archive to comp with the compres‐
19     sion method specific comp_flags.  The comp is the same as returned by
20     zip_stat(3).  For the comp argument, currently only the following values
21     are supported:
22
23     ZIP_CM_DEFAULT     default compression; currently the same as
24                        ZIP_CM_DEFLATE, but flags are ignored.
25
26     ZIP_CM_STORE       Store the file uncompressed.
27
28     ZIP_CM_BZIP2       Compress the file using the bzip2(1) algorithm.
29
30     ZIP_CM_DEFLATE     Deflate the file with the zlib(3) algorithm and
31                        default options.
32
33     NOTE: Only the deflate and store methods can be assumed to be universally
34     supported.
35
36     The comp_flags argument defines the compression level, 1 being fastest
37     compression and 9 highest.  Allowed values are 0 (which uses the default
38     compression for the algorithm) and 1-9, other values are undefined.  Fur‐
39     ther compression method specific flags might be added over time.
40
41     The current compression method for a file in a zip archive can be deter‐
42     mined using zip_stat(3).
43

RETURN VALUES

45     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
46     the error information in archive is set to indicate the error.
47

ERRORS

49     zip_set_file_compression() fails if:
50
51     [ZIP_ER_COMPNOTSUPP]
52                        Unsupported compression method requested.
53
54     [ZIP_ER_INVAL]     index is not a valid file index in archive, or the
55                        argument combination is invalid.
56
57     [ZIP_ER_RDONLY]    Read-only zip file, no changes allowed.
58

SEE ALSO

60     libzip(3), zip_compression_method_supported(3), zip_stat(3)
61

HISTORY

63     zip_set_file_compression() was added in libzip 0.11.
64

AUTHORS

66     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
67
68BSD                              April 2, 2020                             BSD
Impressum