frizinak/zip-streamer

Stream zipped data while adding files

Installs: 21 581

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/frizinak/zip-streamer

0.1.4 2017-03-10 07:50 UTC

This package is not auto-updated.

Last update: 2025-09-27 21:50:32 UTC


README

Build Status

Usage

$output = new ThrottledHttp('download', 1024 * 1024 * 3); // Stream ~3 MB/s
$zip = new ZipStreamer($output);
foreach($images as $filePath){
  $zip->add('images/' . basename($filePath), $filePath); // No deflation
  $zip->send(); // starts reading from $filePath and streaming the zip.
}

foreach($httpTextFiles as $fileUri) {
  $zip->add('txts/' . basename($fileUri), $fileUri, 9); // Max deflation level.
}

$fh = fopen('http://www.google.com', 'rb');
$zip->add('google.html', $fh, -1); // Default zlib delfation level.

$zip->flush(); // Sends any remaining files and finishes streaming the zip.

License: MIT