1 <?hh // decl /* -*- mode: php -*- */
3 * Copyright (c) 2014, Facebook, Inc.
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.
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;
27 const ER_ZIPCLOSED = 8;
30 const ER_TMPOPEN = 12;
32 const ER_CHANGED = 15;
33 const ER_COMPNOTSUPP = 16;
36 const ER_INTERNAL = 20;
39 const ER_DELETED = 23;
40 const ER_ENCRNOTSUPP = 24;
42 const ER_NOPASSWD = 26;
43 const ER_WRONGPASSWD = 27;
44 const CM_DEFAULT = -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;
53 const CM_DEFLATE64 = 9;
54 const CM_PKWARE_IMPLODE = 10;
57 const CM_WAVPACK = 97;
73 public int $statusSys;
75 public string $filename;
76 public string $comment;
79 public function __construct();
80 public function addEmptyDir(string $dirname): bool;
81 public function addFile(
83 string $localname = "",
87 public function addFromString(string $localname, string $contents): bool;
88 public function addGlob(
91 array $options = array(),
93 public function addPattern(
96 array $options = array(),
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(
110 public function getFromName(
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(
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
143 function zip_close(resource $zip): void;
146 * Close a directory entry
149 function zip_entry_close(resource $zip_entry): bool;
152 * Retrieve the compressed size of a directory entry
155 function zip_entry_compressedsize(resource $zip_entry): int;
158 * Retrieve the compression method of a directory entry
161 function zip_entry_compressionmethod(resource $zip_entry): string;
164 * Retrieve the actual file size of a directory entry
167 function zip_entry_filesize(resource $zip_entry): int;
170 * Retrieve the name of a directory entry
173 function zip_entry_name(resource $zip_entry): string;
176 * Open a directory entry for reading
179 function zip_entry_open(
186 * Read from an open directory entry
189 function zip_entry_read(
195 * Open a ZIP file archive
198 function zip_open(string $filename): mixed; // resource or false
201 * Read next entry in a ZIP file archive
204 function zip_read(resource $zip); // resource or false