We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have the following code:
public static void Extract(string archivePath, string destPath, string archiveRoot = "/") { using (Stream stream = File.OpenRead(archivePath)) { var reader = ArchiveFactory.Open(stream); var entries = reader.Entries.ToList(); if (entries.Count < 1) throw new ArchiveException($"Empty archive: {archivePath}"); var firstEntry = entries.First(); var isGithubTarball = (entries.Count == 1 && firstEntry.IsDirectory && firstEntry.Key.Contains("-")); Console.WriteLine($"Extracting {archivePath} to {destPath} (root: {archiveRoot}) [entries: {entries.Count}, isGithubTarball: {isGithubTarball}]"); if (isGithubTarball && archiveRoot == "/") { Extract(archivePath, destPath, archiveRoot + firstEntry.Key); return; } foreach (var entry in reader.Entries) { if (!entry.IsDirectory && entry.Key != null) { // Add null check here string entryPath = entry.Key; if (entryPath.StartsWith(archiveRoot)) { entryPath = entryPath.Substring(archiveRoot.Length); } entry.WriteToDirectory(Path.Combine(destPath, entryPath), new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } } }
and the first entry has a CRC but it's key or other attributes are always null:
Related archive: https://github.com/dayz-cc/serverfiles/archive/refs/heads/main.tar.gz Related phind convo: https://www.phind.com/agent?cache=cltk80vqr001ola08l98kgz9b
The text was updated successfully, but these errors were encountered:
use entry.OpenEntryStream and you can point that stream where ever you want...this is what WriteToDirectory uses
https://github.com/adamhathcock/sharpcompress/blob/master/src/SharpCompress/Archives/IArchiveEntryExtensions.cs
Sorry, something went wrong.
No branches or pull requests
I have the following code:
and the first entry has a CRC but it's key or other attributes are always null:
Related archive: https://github.com/dayz-cc/serverfiles/archive/refs/heads/main.tar.gz
Related phind convo: https://www.phind.com/agent?cache=cltk80vqr001ola08l98kgz9b
The text was updated successfully, but these errors were encountered: