Skip to content

Commit b480694

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

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

README.md

Lines changed: 27 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,13 +163,19 @@ 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.
165173

166174
---
167175
### zstd\_compress\_dict — Zstandard compression using a digested dictionary
168176

177+
> deprecated: use zstd\_compress() insted
178+
169179
#### Description
170180

171181
``` php
@@ -198,6 +208,8 @@ Returns the compressed data or FALSE if an error occurred.
198208
---
199209
### zstd\_uncompress\_dict — Zstandard decompression using a digested dictionary
200210

211+
> deprecated: use zstd\_uncompress() insted
212+
201213
#### Description
202214

203215
``` php
@@ -229,7 +241,7 @@ Returns the decompressed data or FALSE if an error occurred.
229241
#### Description
230242

231243
``` php
232-
zstd_compress_init ( int $level = ZSTD_COMPRESS_LEVEL_DEFAULT ): Zstd\Compress\Context|false
244+
zstd_compress_init ( int $level = ZSTD_COMPRESS_LEVEL_DEFAULT, ?string $dict = null ): Zstd\Compress\Context|false
233245
```
234246

235247
Initialize an incremental compress context
@@ -241,6 +253,10 @@ Initialize an incremental compress context
241253
The higher the level, the slower the compression.
242254
(Defaults to `ZSTD_COMPRESS_LEVEL_DEFAULT`)
243255

256+
* _dict_
257+
258+
The Dictionary data.
259+
244260
#### Return Values
245261

246262
Returns a zstd context instance on success, or FALSE on failure
@@ -280,11 +296,17 @@ Returns a chunk of compressed data, or FALSE on failure.
280296
#### Description
281297

282298
``` php
283-
zstd_uncompress_init ( void ): Zstd\UnCompress\Context|false
299+
zstd_uncompress_init ( ?string $dict = null ): Zstd\UnCompress\Context|false
284300
```
285301

286302
Initialize an incremental uncompress context
287303

304+
#### Parameters
305+
306+
* _dict_
307+
308+
The Dictionary data.
309+
288310
#### Return Values
289311

290312
Returns a zstd context instance on success, or FALSE on failure
@@ -370,6 +392,7 @@ readfile("compress.zstd:///path/to/data.zstd");
370392
$context = stream_context_create([
371393
'zstd' => [
372394
'level' => ZSTD_COMPRESS_LEVEL_MIN,
395+
// 'dict' => $dict,
373396
],
374397
],
375398
);

zstd.stub.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,43 @@
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

59+
/** @deprecated */
5760
function compress_dict(string $data, string $dict, int $level = ZSTD_COMPRESS_LEVEL_DEFAULT): string|false {}
5861

62+
/** @deprecated */
5963
function uncompress_dict(string $data, string $dict): string|false {}
6064

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

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

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

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

0 commit comments

Comments
 (0)