File: streams_9.phpt

package info (click to toggle)
php-zstd 0.14.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,536 kB
  • sloc: ansic: 30,009; asm: 382; xml: 179; makefile: 3
file content (42 lines) | stat: -rw-r--r-- 827 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
compress.zstd streams with file functions, using append mode
--FILE--
<?php
include(dirname(__FILE__) . '/data.inc');

$file = dirname(__FILE__) . '/data_' . basename(__FILE__, ".php") . '.out';

echo "Compression\n";

var_dump($f = fopen('compress.zstd://' . $file, "a"));
$l = (int)(strlen($data) / 2);
if ($f) {
	var_dump(fwrite($f, substr($data, 0, $l)));
	var_dump(fclose($f));
}

var_dump($f = fopen('compress.zstd://' . $file, "a"));
if ($f) {
	var_dump(fwrite($f, substr($data, $l)));
	var_dump(fclose($f));
}

echo "Decompression\n";

$decomp = file_get_contents('compress.zstd://' . $file);
var_dump($decomp == $data);

@unlink($file);
?>
===Done===
--EXPECTF--
Compression
resource(%d) of type (stream)
int(%d)
bool(true)
resource(%d) of type (stream)
int(%d)
bool(true)
Decompression
bool(true)
===Done===