Skip to content

Extract files to stream #88

@mstimvol

Description

@mstimvol

Description
It would be great to have a function to extract files to a stream instead of a directory. At the moment, I'm calling openFromStream to read my zip archive and then calling extractTo to extract all the files to a temporary directory. Next, I'm using a foreach-loop to iterate through the files and send them back to another stream. So writing / extracting them to the local disk is completely unnecessary since I want to read the zip archive from a stream, use a foreach loop to iterate over all entries and extract each file to a stream.

Example

$zipfile = new \PhpZip\ZipFile();
$zipfile->openFromStream($myRemoteStream);

foreach ($zipfile as $entryName) {
    $stream = openStream();
    // Extract the content of $entryName to the given stream...
    $zipfile->extractTo($stream, $entryName);
    close($stream);
}

$zipfile->close();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions