ZipArchive vs GZipStream

192 Views Asked by At

When we create a ZipArchive from a memory stream we can check the result for number of entries. Can we do the same for a GZipStream, to know the number of entries ?

For example:

using var extractArchive = new ZipArchive(stream, ZipArchiveMode.Read, false);
int i = extractArchive.Entries;

is there an equivalent for a Gzip Stream

           var ms = new MemoryStream();

        
        using (var gzstream = new GZipStream(ms, CompressionMode.Decompress, true))
        {
            gzstream.CopyTo(ms);
        }

ms.Entries? is this possible is there a way to know the number of files (entries) in a GZip Stream? Can we make a archive from a GZip stream?

1

There are 1 best solutions below

0
Progman On BEST ANSWER

The GZipStream class is for data compression only. It is not an archive format where you have files and directories. It is only a sequence of bytes (a Stream), so there are no "entries" to read.