Skip to content

Commit 05010cc

Browse files
committed
docs: update README.md and zstd.stub.php
1 parent 34da37f commit 05010cc

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ ZSTD\_VERSION\_TEXT | libzstd version string
117117
#### Description
118118

119119
``` php
120-
zstd_compress ( string $data, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT ): string|false
120+
zstd_compress ( string $data, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT, ?string $dict = null ): string|false
121121
```
122122

123123
Zstandard compression.
@@ -136,6 +136,10 @@ Zstandard compression.
136136
A value smaller than 0 means a faster compression level.
137137
(Zstandard library 1.3.4 or later)
138138

139+
* _dict_
140+
141+
The Dictionary data.
142+
139143
#### Return Values
140144

141145
Returns the compressed data or FALSE if an error occurred.
@@ -146,7 +150,7 @@ Returns the compressed data or FALSE if an error occurred.
146150
#### Description
147151

148152
``` php
149-
zstd_uncompress ( string $data ): string|false
153+
zstd_uncompress ( string $data, ?string $dict = null ): string|false
150154
```
151155

152156
Zstandard decompression.
@@ -159,6 +163,10 @@ Zstandard decompression.
159163

160164
The compressed string.
161165

166+
* _dict_
167+
168+
The Dictionary data.
169+
162170
#### Return Values
163171

164172
Returns the decompressed data or FALSE if an error occurred.
@@ -229,7 +237,7 @@ Returns the decompressed data or FALSE if an error occurred.
229237
#### Description
230238

231239
``` php
232-
zstd_compress_init ( int $level = ZSTD_COMPRESS_LEVEL_DEFAULT ): Zstd\Compress\Context|false
240+
zstd_compress_init ( int $level = ZSTD_COMPRESS_LEVEL_DEFAULT, ?string $dict = null ): Zstd\Compress\Context|false
233241
```
234242

235243
Initialize an incremental compress context
@@ -241,6 +249,10 @@ Initialize an incremental compress context
241249
The higher the level, the slower the compression.
242250
(Defaults to `ZSTD_COMPRESS_LEVEL_DEFAULT`)
243251

252+
* _dict_
253+
254+
The Dictionary data.
255+
244256
#### Return Values
245257

246258
Returns a zstd context instance on success, or FALSE on failure
@@ -280,11 +292,17 @@ Returns a chunk of compressed data, or FALSE on failure.
280292
#### Description
281293

282294
``` php
283-
zstd_uncompress_init ( void ): Zstd\UnCompress\Context|false
295+
zstd_uncompress_init ( ?string $dict = null ): Zstd\UnCompress\Context|false
284296
```
285297

286298
Initialize an incremental uncompress context
287299

300+
#### Parameters
301+
302+
* _dict_
303+
304+
The Dictionary data.
305+
288306
#### Return Values
289307

290308
Returns a zstd context instance on success, or FALSE on failure
@@ -370,6 +388,7 @@ readfile("compress.zstd:///path/to/data.zstd");
370388
$context = stream_context_create([
371389
'zstd' => [
372390
'level' => ZSTD_COMPRESS_LEVEL_MIN,
391+
// 'dict' => $dict,
373392
],
374393
],
375394
);

zstd.stub.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,41 @@
3030
*/
3131
const ZSTD_VERSION_TEXT = UNKNOWN;
3232

33-
function zstd_compress(string $data, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT): string|false {}
33+
function zstd_compress(string $data, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT, ?string $dict = null): string|false {}
3434

35-
function zstd_uncompress(string $data): string|false {}
35+
function zstd_uncompress(string $data, ?string $dict = null): string|false {}
3636

37+
/** @deprecated */
3738
function zstd_compress_dict(string $data, string $dict, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT): string|false {}
3839

40+
/** @deprecated */
3941
function zstd_uncompress_dict(string $data, string $dict): string|false {}
4042

41-
function zstd_compress_init(int $level = ZSTD_COMPRESS_LEVEL_DEFAULT): Zstd\Compress\Context|false {}
43+
function zstd_compress_init(int $level = ZSTD_COMPRESS_LEVEL_DEFAULT, ?string $dict = null): Zstd\Compress\Context|false {}
4244

4345
function zstd_compress_add(Zstd\Compress\Context $context, string $data, bool $end = false): string|false {}
4446

45-
function zstd_uncompress_init(): Zstd\UnCompress\Context|false {}
47+
function zstd_uncompress_init(?string $dict = null): Zstd\UnCompress\Context|false {}
4648

4749
function zstd_uncompress_add(Zstd\UnCompress\Context $context, string $data): string|false {}
4850

4951
}
5052

5153
namespace Zstd {
5254

53-
function compress(string $data, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT): string|false {}
55+
function compress(string $data, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT, ?string $dict = null): string|false {}
5456

55-
function uncompress(string $data): string|false {}
57+
function uncompress(string $data, ?string $dict = null): string|false {}
5658

5759
function compress_dict(string $data, string $dict, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT): string|false {}
5860

5961
function uncompress_dict(string $data, string $dict): string|false {}
6062

61-
function compress_init(int $level = ZSTD_COMPRESS_LEVEL_DEFAULT): Compress\Context|false {}
63+
function compress_init(int $level = ZSTD_COMPRESS_LEVEL_DEFAULT, ?string $dict = null): Compress\Context|false {}
6264

6365
function compress_add(Compress\Context $context, string $data, bool $end = false): string|false {}
6466

65-
function uncompress_init(): UnCompress\Context|false {}
67+
function uncompress_init(?string $dict = null): UnCompress\Context|false {}
6668

6769
function uncompress_add(UnCompress\Context $context, string $data): string|false {}
6870

0 commit comments

Comments
 (0)