From eca42d118e439dc0f3796650e8a68992d513f8ee Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 3 Sep 2018 07:12:40 -0400 Subject: add examples/{10,11,12,13}*php, add examples/*zip to .gitignore --- examples/12-add_file_methods.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/12-add_file_methods.php (limited to 'examples/12-add_file_methods.php') diff --git a/examples/12-add_file_methods.php b/examples/12-add_file_methods.php new file mode 100644 index 0000000..def5425 --- /dev/null +++ b/examples/12-add_file_methods.php @@ -0,0 +1,32 @@ + new FileWriter(), +]; + +# create archive in this directory with a comment +ZipStream::send($zip_path, function(ZipStream &$zip) { + # add "hello.txt" to output using the STORE method + $zip->add_file('hello.txt', 'hello world!', [ + # use STORE method (e.g., no compression) + 'method' => Methods::STORE, + ]); + + # add "hola.txt" to output using the DEFLATE method + $zip->add_file('hola.txt', 'hola!!', [ + # use DEFLATE method (e.g., compressed) + 'method' => Methods::DEFLATE, + ]); +}, $zip_args); -- cgit v1.2.3