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

Add file from data #5

Closed
Firtzberg opened this issue Oct 7, 2019 · 2 comments
Closed

Add file from data #5

Firtzberg opened this issue Oct 7, 2019 · 2 comments

Comments

@Firtzberg
Copy link
Contributor

Hi, I'm trying to add a new file to the archive from raw data (string).
I tried using the addFile() method from the underlying ZipStream implementation, but when I do so nothing gets downloaded. The content is dumped to the browser window instead.
Here's a sample code.

use STS\ZipStream\ZipStreamFacade;

$zipStream = ZipStreamFacade::create('name.zip');
$zipStream->addFile('main.json', 'raw content');
return $zipStream;
@jszobody
Copy link
Member

jszobody commented Oct 7, 2019

I just added support for raw file data and tagged version 1.6. Please update to this version and give it a try:

use Zip;

return Zip::create("name.zip")
    ->add('raw content', 'foo.txt');

@jszobody jszobody closed this as completed Oct 7, 2019
@Firtzberg
Copy link
Contributor Author

Thank you!
This works.

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