Add setCompressionIndex to ZipArchive functions
[hiphop-php.git] / hphp / hack / hhi / stdlib / builtins_zip.hhi
blobd49c8a504777083f1aa095eadbf2722f86c1b99f
1 <?hh // decl /* -*- mode: php -*- */
2 /**
3  * Copyright (c) 2014, Facebook, Inc.
4  * All rights reserved.
5  *
6  * This source code is licensed under the BSD-style license found in the
7  * LICENSE file in the "hack" directory of this source tree. An additional grant
8  * of patent rights can be found in the PATENTS file in the same directory.
9  *
10  */
12 class ZipArchive {
14   // Constants
15   const CHECKCONS = 4;
16   const OVERWRITE = 8;
17   const FL_NOCASE = 1;
18   const FL_NODIR = 2;
19   const FL_COMPRESSED = 4;
20   const FL_UNCHANGED = 8;
21   const FL_RECOMPRESS = 16;
22   const FL_ENCRYPTED = 32;
23   const ER_MULTIDISK = 1;
24   const ER_RENAME = 2;
25   const ER_CLOSE = 3;
26   const ER_WRITE = 6;
27   const ER_ZIPCLOSED = 8;
28   const ER_NOENT = 9;
29   const ER_EXISTS = 10;
30   const ER_TMPOPEN = 12;
31   const ER_MEMORY = 14;
32   const ER_CHANGED = 15;
33   const ER_COMPNOTSUPP = 16;
34   const ER_INVAL = 18;
35   const ER_NOZIP = 19;
36   const ER_INTERNAL = 20;
37   const ER_INCONS = 21;
38   const ER_REMOVE = 22;
39   const ER_DELETED = 23;
40   const ER_ENCRNOTSUPP = 24;
41   const ER_RDONLY = 25;
42   const ER_NOPASSWD = 26;
43   const ER_WRONGPASSWD = 27;
44   const CM_DEFAULT = -1;
45   const CM_STORE = 0;
46   const CM_SHRINK = 1;
47   const CM_REDUCE_1 = 2;
48   const CM_REDUCE_2 = 3;
49   const CM_REDUCE_3 = 4;
50   const CM_REDUCE_4 = 5;
51   const CM_IMPLODE = 6;
52   const CM_DEFLATE = 8;
53   const CM_DEFLATE64 = 9;
54   const CM_PKWARE_IMPLODE = 10;
55   const CM_BZIP2 = 12;
56   const CM_TERSE = 18;
57   const CM_WAVPACK = 97;
58   const CREATE = 1;
59   const EXCL = 2;
60   const ER_OK = 0;
61   const ER_SEEK = 4;
62   const ER_READ = 5;
63   const ER_CRC = 7;
64   const ER_OPEN = 11;
65   const ER_ZLIB = 13;
66   const ER_EOF = 17;
67   const CM_LZMA = 14;
68   const CM_LZ77 = 19;
69   const CM_PPMD = 98;
71   // Properties
72   public int $status;
73   public int $statusSys;
74   public int $numFiles;
75   public string $filename;
76   public string $comment;
78   // Methods
79   public function __construct();
80   public function addEmptyDir(string $dirname): bool;
81   public function addFile(
82     string $filename,
83     string $localname = "",
84     int $start = 0,
85     int $length = 0,
86   ): bool;
87   public function addFromString(string $localname, string $contents): bool;
88   public function addGlob(
89     string $pattern,
90     int $flags = 0,
91     array $options = array(),
92   ): bool;
93   public function addPattern(
94     string $pattern,
95     string $path = ".",
96     array $options = array(),
97   ): bool;
98   public function close(): bool;
99   public function deleteIndex(int $index): bool;
100   public function deleteName(string $name): bool;
101   public function extractTo(string $destination, $entries = array()): bool;
102   public function getArchiveComment(int $flags = 0): string;
103   public function getCommentIndex(int $index, int $flags = 0): string;
104   public function getCommentName(string $name, int $flags = 0): string;
105   public function getFromIndex(
106     int $index,
107     int $length = 0,
108     int $flags = 0,
109   ): string;
110   public function getFromName(
111     string $name,
112     int $length = 0,
113     int $flags = 0,
114   ): string;
115   public function getNameIndex(int $index, int $flags = 0): string;
116   public function getStatusString(): string;
117   public function getStream(string $name): mixed;
118   public function locateName(string $name, int $flags = 0): mixed;
119   public function open(string $filename, int $flags = 0): mixed;
120   public function renameIndex(int $index, string $newname): bool;
121   public function renameName(string $name, string $newname): bool;
122   public function setArchiveComment(string $comment): bool;
123   public function setCommentIndex(int $index, string $comment): bool;
124   public function setCommentName(string $name, string $comment): bool;
125   public function setCompressionIndex(
126     int $index,
127     int $comp_method,
128     int $comp_flags = 0,
129   ): bool;
130   public function statIndex(int $index, int $flags = 0): array;
131   public function statName(string $name, int $flags = 0): array;
132   public function unchangeAll(): bool;
133   public function unchangeArchive(): bool;
134   public function unchangeIndex(int $index): bool;
135   public function unchangeName(string $name): bool;
140  * Close a ZIP file archive
141  */
142 <<__PHPStdLib>>
143 function zip_close(resource $zip): void;
146  * Close a directory entry
147  */
148 <<__PHPStdLib>>
149 function zip_entry_close(resource $zip_entry): bool;
152  * Retrieve the compressed size of a directory entry
153  */
154 <<__PHPStdLib>>
155 function zip_entry_compressedsize(resource $zip_entry): int;
158  * Retrieve the compression method of a directory entry
159  */
160 <<__PHPStdLib>>
161 function zip_entry_compressionmethod(resource $zip_entry): string;
164  * Retrieve the actual file size of a directory entry
165  */
166 <<__PHPStdLib>>
167 function zip_entry_filesize(resource $zip_entry): int;
170  * Retrieve the name of a directory entry
171  */
172 <<__PHPStdLib>>
173 function zip_entry_name(resource $zip_entry): string;
176  * Open a directory entry for reading
177  */
178 <<__PHPStdLib>>
179 function zip_entry_open(
180   resource $zip,
181   resource $zip_entry,
182   string $mode,
183 ): bool;
186  * Read from an open directory entry
187  */
188 <<__PHPStdLib>>
189 function zip_entry_read(
190   resource $zip_entry,
191   int $length = 1024,
192 ): string;
195  * Open a ZIP file archive
196  */
197 <<__PHPStdLib>>
198 function zip_open(string $filename): mixed; // resource or false
201  * Read next entry in a ZIP file archive
202  */
203 <<__PHPStdLib>>
204 function zip_read(resource $zip); // resource or false