Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save zip without compression #94

Open
GDenisC opened this issue Mar 4, 2023 · 5 comments
Open

Save zip without compression #94

GDenisC opened this issue Mar 4, 2023 · 5 comments

Comments

@GDenisC
Copy link

GDenisC commented Mar 4, 2023

Q A
Library version(s) affected: 4.01
PHP version(s): 8.1.2
OS (with bit depth): Windows 10 64-bit

Description
How save zip without compression (all files)?

How to reproduce

$zip = new ZipFile();
$zip->openFile($fileName);
/* some code */
$zip->setCompressionMethodEntry(what do you mean with entry?, ZipCompressionMethod::STORED)->/* etc */;
@odan
Copy link
Contributor

odan commented Mar 5, 2023

According to the documentation:

$zip->addFile($file, $entryName, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression

or

$zip->addFromString('file', 'content', \PhpZip\Constants\ZipCompressionMethod::STORED);

what do you mean with entry?

The $entryName is the filename within the zip archive.

@GDenisC
Copy link
Author

GDenisC commented Mar 6, 2023

i mean all files (with directories), because i need $zip->openFile($fileName);

@odan
Copy link
Contributor

odan commented Mar 6, 2023

The openFile method is to open a ZIP file and can be used in combination with the extractTo method to extract files from that ZIP file.

Are you trying to "change" an existing ZIP file to an ZIP file with uncompressed content?
Can please add more details about your specific use-case?

@GDenisC
Copy link
Author

GDenisC commented Mar 6, 2023

Yes, I want to open a zip file with a lot of compressed files, export it, change some files and save as uncompressed zip.

@odan
Copy link
Contributor

odan commented Mar 6, 2023

You can already do this with the existing methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants