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

Support callback for output #199

Open
hschletz opened this issue Nov 5, 2021 · 1 comment
Open

Support callback for output #199

hschletz opened this issue Nov 5, 2021 · 1 comment

Comments

@hschletz
Copy link

hschletz commented Nov 5, 2021

Description of the problem

Output is done to a stream, STDOUT by default, but can be set to an arbitrary stream.

Sometimes this is not flexible enough. For example, I want to write to 2 streams simultaneously. There may also be situations where a stream is not supported by a particular output method.

This could be solved by a custom stream wrapper or filter, but a callback for output would be much simpler. Would it be possible to support that?

Example code

// Example for new callback option. Overrides default stream output.
$options = new ZipStream\Option\Archive();
$options->setOutputCallback(function ($data) {
    write_output($data);
});
@maennchen
Copy link
Owner

I would welcome an addition, that would support this the following way:

PRs are welcome for this.

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

No branches or pull requests

2 participants