A fast and efficient forward-only reader for `Cpio` archives.
$ dotnet add package Community.Archives.CpioA fast and efficient forward-only reader for Cpio archives.
Task to offload IO to separate threads.This package is part of Gitii/Community.Archives: A collection of libraries that support reading various popular archives.
On any platform that's supported by the above frameworks, including Windows, Linux and MacOS.
CpioArchiveReader is implemented based on Ubuntu Manpage - cpio — format of cpio archive files.
Only New ASCII Format format is supported
Cpio files do not have metadata. GetMetaDataAsync will throw an exception at runtime.
var reader = new CpioArchiveReader();
await foreach (
var entry in reader
.GetFileEntriesAsync(stream, IArchiveReader.MATCH_ALL_FILES)
) {
// entry.Name
// entry.Content
Console.WriteLine($"Found file {entry.Name} ({entry.Content.Length} bytes)")
}
var reader = new CpioArchiveReader();
// use regular expression to match files (path + file name)
await foreach (
var entry in reader
.GetFileEntriesAsync(stream, "[.]md$", "[.]txt$")
) {
// found a Markdown or text file
}