laravel-zipstream icon indicating copy to clipboard operation
laravel-zipstream copied to clipboard

store zip file to s3 only without streaming

Open kevinlau-drewberry opened this issue 1 year ago • 4 comments

hi, understand the purpose of this package is to stream zip files. However, I am not able to find an alternative package.

Is it possible to only store the zip file to s3 without downloading it right away?

        $zip = Zip::create($filename)->setPath($path);
        foreach($files as $file)
        {
            $zip->add(
                File::make($file->{ContentVersion::CUSTOM_FIELD_URL},$file->{ContentVersion::FIELD_PATHONCLIENT})
                      ->setFilesize($file->{ContentVersion::FIELD_CONTENTSIZE})
            );
        }
        $zip->saveToDisk('s3', $path);

I can save the zip to s3 but it forced me to download it as well.

kevinlau-drewberry avatar Jul 16 '24 13:07 kevinlau-drewberry

Hmm, that should be possible. I'll look into it.

jszobody avatar Jul 17 '24 01:07 jszobody

@jszobody any updates on that?

marcorieser avatar Oct 08 '24 08:10 marcorieser

I am looking the same solutions. have you solved yet @marcorieser ?

mdxrathik avatar Oct 15 '24 16:10 mdxrathik

I am looking the same solutions. have you solved yet @marcorieser ?

I just created a temp disk, stuffed all in there and then used PHPs regular ZipArchive functionality to pack that folder. Different approach.

marcorieser avatar Oct 15 '24 16:10 marcorieser

v5.6 takes care of this now folks. The underlying zipstream package automatically sends HTTP headers, so I had to suppress those in order to save a zip to disk without triggering a download. Let me know if you still hit any issues with it.

jszobody avatar Jul 23 '25 20:07 jszobody