Wrote function to extract all tarball content, simplified GetTarballContentNames
This commit is contained in:
parent
4ccce78877
commit
3c5a161bbb
1 changed files with 9 additions and 1 deletions
|
@ -48,6 +48,14 @@ public static class Utilities
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<string> GetTarballContentNames(string tarballPath)
|
public static IEnumerable<string> GetTarballContentNames(string tarballPath)
|
||||||
|
{
|
||||||
|
foreach (var entry in GetTarballContent(tarballPath))
|
||||||
|
{
|
||||||
|
yield return entry.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<TarEntry> GetTarballContent(string tarballPath)
|
||||||
{
|
{
|
||||||
using FileStream fileStream = File.OpenRead(tarballPath);
|
using FileStream fileStream = File.OpenRead(tarballPath);
|
||||||
using GZipStream decompressorStream = new(fileStream, CompressionMode.Decompress);
|
using GZipStream decompressorStream = new(fileStream, CompressionMode.Decompress);
|
||||||
|
@ -56,7 +64,7 @@ public static class Utilities
|
||||||
TarEntry entry;
|
TarEntry entry;
|
||||||
while ((entry = reader.GetNextEntry()) is not null)
|
while ((entry = reader.GetNextEntry()) is not null)
|
||||||
{
|
{
|
||||||
yield return entry.Name;
|
yield return entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue