-
Notifications
You must be signed in to change notification settings - Fork 824
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
Creating Zip File from Folder #28
Comments
Although this is not an official feature of the package, it does make it super simple to implement yourself, like so: $local = new Flysystem\FIlesystem(Flysystem\Adapter\Local(__DIR__.'/path/to/dir'));
$zip = new Flysystem\FIlesystem(Flysystem\Adapter\Zip(__DIR__.'/path/to/archive.zip'));
$contents = $local->listContents('', true);
foreach ($contents as $info) {
if ($info['type'] === 'dir') {
continue;
}
$zip->write($info['path'], $local->read($info['path']));
}
// This will trigger saving the zip.
$zip = null; Now you'll have the archive zipped the local directory and stored at |
Thanks again. I somehow figured this logic.. Hope you won't mind if I add this an feature to your Zip adapter as a new function.. |
It's not something that will be included in the default zip adapter, this because it's not a feature that is cross adapter compatible. |
Yeah. Got your point. Thanks. |
How would I zip an entire folder and make it available as a zip file? I have couple of views on the documents and I am not able to get any info on zipping the files.
Please let me know if I am missing any thing on this.
The text was updated successfully, but these errors were encountered: