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