1
Vote

Expose Stream object for each file inside 7z archive

description

Frequently I have an unseekable stream (e.g. web/ftp download or part of some other archive), and I need to uncompress and process each file in turn. #ziplib provides it with ZipInputStream class. Could 7z expose something similar? See http://sevenzipsharp.codeplex.com/discussions/227187 for discussion.
 
// Example using sharpziplib. Notice that I can continue processing the streams by chaining additional filters without storing uncompressed data to a temporary location like memory or disk.
 
IEnumerable<Stream> UnZipStream(Stream stream)
{
using (var zipStream = new ZipInputStream(stream))
{
    ZipEntry entry;
    while ((entry = zipStream.GetNextEntry()) != null)
        if (entry.IsFile)
            yield return zipStream;
}
}

comments