Skip to content

Support callback for output #199

@hschletz

Description

@hschletz

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);
});

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions